Better handling of native errors