mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-06-13 05:55:26 +00:00
15 lines
282 B
JavaScript
15 lines
282 B
JavaScript
![]() |
export default class Invalid {
|
||
|
constructor(reason, explanation) {
|
||
|
this.reason = reason;
|
||
|
this.explanation = explanation;
|
||
|
}
|
||
|
|
||
|
toMessage() {
|
||
|
if (this.explanation) {
|
||
|
return `${this.reason}: ${this.explanation}`;
|
||
|
} else {
|
||
|
return this.reason;
|
||
|
}
|
||
|
}
|
||
|
}
|