Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Remove a catch of Throwable in object.d #1743

Merged
merged 1 commit into from
Mar 17, 2017
Merged

Conversation

JackStouffer
Copy link
Member

@JackStouffer JackStouffer commented Jan 16, 2017

Catching Throwable is a bad idea most of the time.

  • In the first case, it was a relic that can be safely removed
  • In the second case, there's no obvious reason why we would want to catch Errors from user code generated by the TraceInfo.opApply

Copy link
Member

@wilzbach wilzbach left a comment

Choose a reason for hiding this comment

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

LGTM

src/object.d Outdated
@@ -1737,7 +1728,7 @@ class Throwable : Object
sink("\n"); sink(t);
}
}
catch (Throwable)
catch (Exception)
{
Copy link
Member

Choose a reason for hiding this comment

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

Is it even at any time a good idea to silently catch Exceptions? It seems to me a bit suspicious that toString doesn't expose the nothrow guarantee publicly, but in the other hand does this silent catching..

Copy link
Member Author

Choose a reason for hiding this comment

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

Exception implies that the program is still in a recoverable state. Errors imply some unrecoverable state.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I know, but I was trying to say that silently swallowing them as it is done in the existing code isn't really a good practice.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, ok :)

@JackStouffer JackStouffer changed the title Remove catches of Throwable in object.d Remove a catch of Throwable in object.d Feb 14, 2017
@JackStouffer
Copy link
Member Author

Had to remove the second change as it's error-ing and I don't have time to debug right now.

@JackStouffer
Copy link
Member Author

Pinging people with merge rights

@schveiguy @jmdavis @DmitryOlshansky

src/object.d Outdated
return cast(size_t)cast(void*)this;
}
auto data = this.toString();
return hashOf(data, 0);
Copy link
Member

Choose a reason for hiding this comment

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

I know that it was like this before, but is there any reason to create a variable here? It seems like a pointless extra line.

@JackStouffer
Copy link
Member Author

@jmdavis Fixed

@dlang-bot dlang-bot merged commit 5a94816 into dlang:master Mar 17, 2017
@schveiguy
Copy link
Member

Just wasted time looking at this, because github doesn't send me notifications of labels being added. Grrr...

@wilzbach
Copy link
Member

Just wasted time looking at this, because github doesn't send me notifications of labels being added. Grrr...

@schveiguy: dlang/dlang-bot#32

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
5 participants