Last active
November 8, 2020 16:59
-
-
Save GitHubStuff/2d30cb8e6b3a3df38bb01ee8d7c21a7c to your computer and use it in GitHub Desktop.
Extend Exception for custom error messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create Exception classes by extending this class. | |
/// - Example: | |
/* | |
class UnknownThemeMode extends AppException { | |
UnknownThemeMode([String message, int code]) : super(message, 'Missing Context', code); | |
} | |
*/ | |
class AppException implements Exception { | |
final message; | |
final prefix; | |
final code; | |
AppException([this.message, this.prefix, this.code]); | |
String toString() { | |
return '{"$prefix" : $message", "code":$code}'; | |
} | |
} |
better instruction layout
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added a some instructions