Exception(label)
Exception thrower.
Constructor
new Exception(label)
Parameters:
Name | Type | Description |
---|---|---|
label
|
string | Log label |
- License:
- Apache-2.0Copyright 2020 Satoshi Soma
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. - Source:
- src/scripts/Exception.js, line 19
Methods
error(…argsrpt)
Logs an exception to console as an error.
Parameters:
Name | Type | Description |
---|---|---|
args rpt
|
any | Same as Exception#new |
- Source:
- src/scripts/Exception.js, line 45
new(msg, infoopt)
Generates a new exception instance.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
msg
|
string | Message |
|
info opt
|
any |
null
|
Additional info |
- Source:
- src/scripts/Exception.js, line 31
throw(…argsrpt)
Throws an exception.
Parameters:
Name | Type | Description |
---|---|---|
args rpt
|
any | Same as Exception#new |
- Source:
- src/scripts/Exception.js, line 38
warn(…argsrpt)
Logs an exception to console as a warning.
Parameters:
Name | Type | Description |
---|---|---|
args rpt
|
any | Same as Exception#new |
- Source:
- src/scripts/Exception.js, line 62
withError(x, …argsrpt) → any
Logs an exception to console as an error, and returns the given value.
Parameters:
Name | Type | Description |
---|---|---|
x
|
any | Return value |
args rpt
|
any | Same as Exception#new |
- Source:
- src/scripts/Exception.js, line 54
Returns:
x
- Type:
- any
withWarn(x, …argsrpt) → any
Logs an exception to console as a warning, and returns the given value.
Parameters:
Name | Type | Description |
---|---|---|
x
|
any | Return value |
args rpt
|
any | Same as Exception#new |
- Source:
- src/scripts/Exception.js, line 71
Returns:
x
- Type:
- any