1.1.3
Base class for all errors defined by
Jpi, as well as any application-defined
errors. This class does not have its own code
property, but does provide a
getter for the code on instances, so codes only need to be defined on
subclass constructors.
To create your own application-defined JSON-RPC error, inherit from this class and assign an integer code to the subclass's constructor. The code must be an integer greater than -32099, as specified by the JSON-RPC standard.
This class, as well as all other error classes in ths project, inherit from NaniError and may use any of the constructor arguments of that class. For more information, see Nani.
Extends NaniError
Class for standard JSON-RPC parse errors.
Extends JpiError
Class for standard JSON-RPC invalid request errors.
Extends JpiError
Class for standard JSON-RPC method not found errors.
Extends JpiError
Class for standard JSON-RPC invalid params errors.
Extends JpiError
Class for standard JSON-RPC internal errors.
Extends JpiError
Class for generic Jpi server errors.
Will be used by Jpi to wrap any error thrown by a middleware that is not a
JpiError
with an integer code.
To define your own server errors for your application, do not inherit from
this class. Inherit from the base JpiError
class instead.
Extends JpiError
Converts an Error instance-- along with its entire cause chain-- into a
JSON-RPC-compliant error object. Objects will include message
properties,
as well as a data object that will include any and all properties supported
by Nani. They will also include code
properties, though they will be placed either in the data or at the top level
based on a number of factors:
A code
will appear in the top level of its object if and only if:
JpiError
(see
Nani.is)In all other cases, code
s will be included in the data object instead.
(Error)
Error instance to convert.
(boolean
= false
)
Set to true to include stack traces
in the results. Due to the performance penalty of accessing the stack
property in V8, this should generally not be used in production
environments.
Object
:
Created JSON-RPC error object.
Converts a JSON-RPC Error object to an Error instance. Errors will be created
with the standard Error constructor, but they will include all properties
supported by Nani, as well as the
code
property.
There will be no stack frames on any Error created by this function, unless they are provided in the object, because there is otherwise no way to tell anything about where the error originally came from. If you plan on throwing any of these errors, you should wrap them with new errors to so you can have a useful stack trace.
(Object)
JSON-RPC error object.
Error
:
Created Error instance.