Provide a description of an error processing a document.
More...
Detailed Description
- Outline
-
-
- Purpose:
- Provide a description of an error processing a document.
-
- Classes:
-
- See also:
- Component bdljsn_jsonutil, Component bdljsn_json
-
- Description:
- This component provides a single, un-constrained (value-semantic) attribute class,
bdljsn::Error
, that is used to describe an error in the occured processing a (JSON) document.
-
- Attributes:
Name Type Default
------------------ ----------- -------
location Location Location(0)
message string ""
-
location
: the location in the document where the error occured
-
message
: a description of the error that occured
-
- Usage:
- This section illustrates intended use of this component.
-
- Example 1: Populating an bdljsn::Error Object:
- This component is designed to describe an error that occured when processing a (JSON) document. Suppose we are implementing a function,
extractIntegerToken
, that parses a numeric token and obtains an int
value:
- First, we define the function signature: Then, we attempt to exact a
int
value from the inputText
: Now, we check the parse status and if unsuccessful, we use the status information to set the bsljsn::Error
object expected by our caller: Finally, if the parse was successful, set the output parameter and return with status value that indicates success. *value = result;
return e_SUCCESS;
}