DarkMatter  4.1.0
DarkMatterError Class Reference

A class representing a DarkMatter error. More...

Inherits RuntimeException.

Public Member Functions

 DarkMatterError ()
 Initializes the instance with default values.
 
 DarkMatterError (int code)
 Initializes the instance with the given error code. More...
 
 DarkMatterError (int code, String msg)
 Initializes the instance with the given error code and message. More...
 
 DarkMatterError (int code, String msg, JsonObject data)
 Initializes the instance with the given error code, message, and data. More...
 
 DarkMatterError (int code, String msg, JsonObject data, Map< String, String > headers)
 Initializes the instance with the given values. More...
 
 DarkMatterError (int code, Exception ex)
 Initializes the instance with the given error code and Java Exception. More...
 

Static Public Member Functions

static boolean shouldRetry (int code)
 Used to determine if a network request should be retried based on the status code. More...
 

Public Attributes

int code = 0
 The error code.
 
JsonObject data = null
 Data associated with the error.
 
Map< String, String > headers = null
 HTTP headers associated with the error.
 

Detailed Description

A class representing a DarkMatter error.

Constructor & Destructor Documentation

◆ DarkMatterError() [1/5]

DarkMatterError ( int  code)

Initializes the instance with the given error code.

Parameters
codeThe error code.

◆ DarkMatterError() [2/5]

DarkMatterError ( int  code,
String  msg 
)

Initializes the instance with the given error code and message.

Parameters
codeThe error code.
msgThe error message.

◆ DarkMatterError() [3/5]

DarkMatterError ( int  code,
String  msg,
JsonObject  data 
)

Initializes the instance with the given error code, message, and data.

Parameters
codeThe error code.
msgThe error message.
dataThe associated data.

◆ DarkMatterError() [4/5]

DarkMatterError ( int  code,
String  msg,
JsonObject  data,
Map< String, String >  headers 
)

Initializes the instance with the given values.

Parameters
codeThe error code.
msgThe error message.
dataThe associated data.
headersThe associated HTTP headers.

◆ DarkMatterError() [5/5]

DarkMatterError ( int  code,
Exception  ex 
)

Initializes the instance with the given error code and Java Exception.

Parameters
codeThe error code.
exA Java Exception.

Member Function Documentation

◆ shouldRetry()

static boolean shouldRetry ( int  code)
static

Used to determine if a network request should be retried based on the status code.

Parameters
codeThe HTTP status code.
Returns
true if the network request should be retried.