userError: userError

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/UserError.R

Description

Generates an error of class userError

Usage

1

Arguments

message

error msg

class

character vector: the classes hyrarchy below class userError. First entry is the most specialized

call

call expression.

Details

Creates an error of subclass of error. This class can be used in tryCatch to handle different error sources

Value

error of class c(class,"userError","error")

Author(s)

Thomas Wutzler

See Also

twMisc

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
res <- tryCatch({
        #stop( userError("My error message") )
        stop( userError(class="argsError", "My error message") )
    }
    ,argsError=function(e){ 
        cat("Handle my very specialized error of class argsError/userError/error\n"); 
        print(e)
    }
    ,userError=function(e){ 
        cat("Handle my specialized errors of class userError/error\n"); 
        print(e)
    }
    ,error=function(e){
        cat("Handle all the other errors\n")
        print(e)
    }
    ,finally=function(){
        cat("Finally clear up.")
    }
) # end of tryCatch

twMisc documentation built on May 31, 2017, 4:37 a.m.