Last active
September 9, 2022 19:31
-
-
Save dander11/90f3af291395f53c22dfd649093a3c9f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import 'dart:convert'; | |
| void printToString(Object ex ){ | |
| print(ex.toString()); | |
| } | |
| class MyCustomExceptionObject { | |
| final String message; | |
| MyCustomExceptionObject(this.message); | |
| @override | |
| String toString(){ | |
| throw Exception("not implemented"); | |
| } | |
| } | |
| void main() { | |
| Object exceptionObject = Exception("This is a good error message"); | |
| Object myCustomExceptionObject = MyCustomExceptionObject("This is a Custom exception"); | |
| printToString(exceptionObject.toString()); | |
| printToString(myCustomExceptionObject.toString()); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment