Methods
constructor()
Initialize Register class
- Source:
constructor()
Initialize Register class
error(message, code) → {error}
custom method for error handling. This method returns
the output of _throw from this class.
Parameters:
| Name | Type | Description |
|---|---|---|
message |
string | message / text of the error |
code |
int | the number that the error has |
Returns:
- Type
- error
getAll() → {object}
Get all the errors in the registry.
- Source:
Returns:
- returns all the errors in the registry
- Type
- object
getAllErrors() → {object}
Get the whole register with all the errors. This method returns
the output of getAll from the Register class.
Returns:
- Type
- object
getByNumber(number) → {object}
Get an error by it's number. This method returns
the output of getByNumber from the Register class.
Parameters:
| Name | Type | Description |
|---|---|---|
number |
int | the number of the error |
- Source:
- See:
Returns:
- Type
- object
getByNumber(number) → {string}
Get an error by it's number.
Parameters:
| Name | Type | Description |
|---|---|---|
number |
int | the number that the error has |
- Source:
Returns:
- returns the message of the error
- Type
- string
registerErrorWithNumber(description, number) → {true}
Register / set an error with a number. This method returns
the output of setErrorWithNumber from the Register class.
Parameters:
| Name | Type | Description |
|---|---|---|
description |
string | description text of the error |
number |
int | the number that the error will have |
- Source:
- See:
Throws:
-
- if thrown by setErrorWithNumber
- Type
- error
Returns:
- Type
- true
setErrorWithNumber(description, number) → {true}
Add an error message and corresponding number
to the registry.
Parameters:
| Name | Type | Description |
|---|---|---|
description |
string | description text of the error |
number |
int | the number that the error will have |
- Source:
Throws:
-
- throws error when incorrect arguments have been passed
- Type
- error
Returns:
- returns true if adding was successful
- Type
- true