Skip to content

Instantly share code, notes, and snippets.

@dander11
Last active September 9, 2022 19:31
Show Gist options
  • Select an option

  • Save dander11/90f3af291395f53c22dfd649093a3c9f to your computer and use it in GitHub Desktop.

Select an option

Save dander11/90f3af291395f53c22dfd649093a3c9f to your computer and use it in GitHub Desktop.
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