1
|
|
###########################################################################/**
|
2
|
|
# @RdocClass RspException
|
3
|
|
# @alias RspParseException
|
4
|
|
# @alias RspPreprocessingException
|
5
|
|
#
|
6
|
|
# @title "The RspException class"
|
7
|
|
#
|
8
|
|
# \description{
|
9
|
|
# @classhierarchy
|
10
|
|
#
|
11
|
|
# An RspException is an @see "R.oo::Exception" that is thrown during
|
12
|
|
# the processing of an RSP document.
|
13
|
|
# }
|
14
|
|
#
|
15
|
|
# @synopsis
|
16
|
|
#
|
17
|
|
# \arguments{
|
18
|
|
# \item{...}{Not used.}
|
19
|
|
# }
|
20
|
|
#
|
21
|
|
# \section{Fields and Methods}{
|
22
|
|
# @allmethods
|
23
|
|
# }
|
24
|
|
#
|
25
|
|
# @author
|
26
|
|
#
|
27
|
|
# @keyword internal
|
28
|
|
#*/###########################################################################
|
29
|
|
setConstructorS3("RspException", function(...) {
|
30
|
1
|
extend(Exception(...), "RspException")
|
31
|
|
})
|
32
|
|
|
33
|
|
|
34
|
|
setConstructorS3("RspParseException", function(...) {
|
35
|
1
|
extend(RspException(...), "RspParseException")
|
36
|
|
})
|
37
|
|
|
38
|
|
|
39
|
|
setConstructorS3("RspPreprocessingException", function(..., item=NULL) {
|
40
|
1
|
extend(RspException(...), "RspPreprocessingException",
|
41
|
1
|
item = item
|
42
|
|
)
|
43
|
|
})
|
44
|
|
|
45
|
|
setMethodS3("getMessage", "RspPreprocessingException", function(this, ...) {
|
46
|
|
## The following is not possible due to bug in R.oo 1.13.0:
|
47
|
|
## msg <- NextMethod()
|
48
|
0
|
msg <- this$.msg
|
49
|
|
|
50
|
0
|
item <- this$item
|
51
|
0
|
if (!is.null(item)) {
|
52
|
0
|
itemStr <- asRspString(item)
|
53
|
0
|
itemStr <- sprintf(" (%s)", itemStr)
|
54
|
|
} else {
|
55
|
0
|
itemStr <- ""
|
56
|
|
}
|
57
|
0
|
sprintf("An error occured while preprocessing RSP directive%s: %s", itemStr, msg)
|
58
|
|
}, createGeneric=FALSE)
|
59
|
|
|
60
|
|
setMethodS3("getItem", "RspPreprocessingException", function(this, ...) {
|
61
|
0
|
this$item
|
62
|
|
})
|