Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
/ druntime Public archive

Remove a catch of Throwable in object.d#1743

Merged
dlang-bot merged 1 commit intodlang:masterfrom
JackStouffer:error
Mar 17, 2017
Merged

Remove a catch of Throwable in object.d#1743
dlang-bot merged 1 commit intodlang:masterfrom
JackStouffer:error

Conversation

@JackStouffer
Copy link
Contributor

@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
Contributor

@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

}
catch (Throwable)
catch (Exception)
{
Copy link
Contributor

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
Contributor 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
Contributor

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
Contributor 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
Contributor 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
Contributor 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
Contributor 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
Contributor

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

Development

Successfully merging this pull request may close these issues.

5 participants