Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 6 additions & 109 deletions Nodejs/Product/Nodejs/Debugger/ExceptionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,117 +84,14 @@ public ExceptionHitTreatment GetExceptionHitTreatment(string exceptionName) {
}

private Dictionary<string, ExceptionHitTreatment> GetDefaultExceptionTreatments() {
// Keep exception types in sync with those declared in ProvideDebugExceptionAttribute's in NodePackage.Debugger.cs
#if FALSE
string[] exceptionTypes = {
};
#endif

string[] breakNeverTypes = {
// should probably be break on unhandled when we have just my code support
"Error",
"Error(EACCES)",
"Error(EADDRINUSE)",
"Error(EADDRNOTAVAIL)",
"Error(EAFNOSUPPORT)",
"Error(EAGAIN)",
"Error(EWOULDBLOCK)",
"Error(EALREADY)",
"Error(EBADF)",
"Error(EBADMSG)",
"Error(EBUSY)",
"Error(ECANCELED)",
"Error(ECHILD)",
"Error(ECONNABORTED)",
"Error(ECONNREFUSED)",
"Error(ECONNRESET)",
"Error(EDEADLK)",
"Error(EDESTADDRREQ)",
"Error(EDOM)",
"Error(EEXIST)",
"Error(EFAULT)",
"Error(EFBIG)",
"Error(EHOSTUNREACH)",
"Error(EIDRM)",
"Error(EILSEQ)",
"Error(EINPROGRESS)",
"Error(EINTR)",
"Error(EINVAL)",
"Error(EIO)",
"Error(EISCONN)",
"Error(EISDIR)",
"Error(ELOOP)",
"Error(EMFILE)",
"Error(EMLINK)",
"Error(EMSGSIZE)",
"Error(ENAMETOOLONG)",
"Error(ENETDOWN)",
"Error(ENETRESET)",
"Error(ENETUNREACH)",
"Error(ENFILE)",
"Error(ENOBUFS)",
"Error(ENODATA)",
"Error(ENODEV)",
"Error(ENOENT)",
"Error(ENOEXEC)",
"Error(ENOLINK)",
"Error(ENOLCK)",
"Error(ENOMEM)",
"Error(ENOMSG)",
"Error(ENOPROTOOPT)",
"Error(ENOSPC)",
"Error(ENOSR)",
"Error(ENOSTR)",
"Error(ENOSYS)",
"Error(ENOTCONN)",
"Error(ENOTDIR)",
"Error(ENOTEMPTY)",
"Error(ENOTSOCK)",
"Error(ENOTSUP)",
"Error(ENOTTY)",
"Error(ENXIO)",
"Error(EOVERFLOW)",
"Error(EPERM)",
"Error(EPIPE)",
"Error(EPROTO)",
"Error(EPROTONOSUPPORT)",
"Error(EPROTOTYPE)",
"Error(ERANGE)",
"Error(EROFS)",
"Error(ESPIPE)",
"Error(ESRCH)",
"Error(ETIME)",
"Error(ETIMEDOUT)",
"Error(ETXTBSY)",
"Error(EXDEV)",
"Error(MODULE_NOT_FOUND)",
"Error(SIGHUP)",
"Error(SIGINT)",
"Error(SIGILL)",
"Error(SIGABRT)",
"Error(SIGFPE)",
"Error(SIGKILL)",
"Error(SIGSEGV)",
"Error(SIGTERM)",
"Error(SIGBREAK)",
"Error(SIGWINCH)",
"EvalError",
"RangeError",
"ReferenceError",
"SyntaxError",
"TypeError",
"URIError",
};

var defaultExceptionTreatments = new Dictionary<string, ExceptionHitTreatment>();
#if FALSE
foreach (string exceptionType in exceptionTypes) {
defaultExceptionTreatments[exceptionType] = ExceptionHitTreatment.BreakAlways;
}
#endif

foreach (string exceptionType in breakNeverTypes) {
defaultExceptionTreatments[exceptionType] = ExceptionHitTreatment.BreakNever;
// Get exception names from in NodePackage.Debugger.cs
foreach (var attr in System.Attribute.GetCustomAttributes(typeof(NodejsPackage))) {
var debugAttr = attr as ProvideNodeDebugExceptionAttribute;
if (debugAttr != null && !string.IsNullOrEmpty(debugAttr.ExceptionName)) {
defaultExceptionTreatments[debugAttr.ExceptionName] = ExceptionHitTreatment.BreakNever;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than risk having this happen again, I refactored this code to remove the duplication. The core fix for the original problem was just the mismatch between using Error() one place and Error the other.

}

return defaultExceptionTreatments;
Expand Down
Loading