try{ //your code here } catch (e, stacktrace) { print('Exception: ' + e.toString()); print('Stacktrace: ' + stacktrace.toString()); }