-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Make ACRAConfiguration final #439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Note: I used my own very simple Implementation for Immutable Collections. Guava contains better optimized versions, but I din't want to add such a huge dependency to the project just for this. |
{edit} removed comment that should have been on another PR |
@william-ferguson-au what do you think? also should we keep |
I agree that
Neither is pretty from a backwards compat POV but the first is more correct. I'd like to get rid of
|
This is what I have in mind #445 |
@william-ferguson-au Maybe now that |
What's the use case? On Fri, 29 Apr 2016, 6:47 AM F43nd1r [email protected] wrote:
|
I consider that to be an extreme edge case that can almost certainly be handled more simply by thinking about the problem differently. Instead of reiterating here why I don't think allowing multiple #inits is a good idea, see my response on SO. |
For handled exceptions, showing case-specific text would still be useful. While it can be possible to recover from an exception the app may not do what's expected, and informing the user would be polite. Particularly important in case some user input could not be saved.
Ideal for that use case would be
|
@jngr I don't understand your comment. If you are handling the Exception within your app then ACRA will not be invoked. |
Yes, true, but unless I use Exceptions as means of program control (which I try to avoid) there is still something wrong, and I want to know about it even if the app recovers to some degree. I believe that's why you included For instance, you can recover from a failed database update but you definitely want to let the user know about it. Or I could imagine other cases where I handle failure of a less important feature to let the user save his data instead of directly exiting the app. |
If you want to have exception specific text in the crash dialog, write your own CrashReportDialog. The base class provides access to the exception. |
OK, but since you're not directly invoking that dialog how would you transport the custom message? That same exception could happen in different places, and the dialog won't know unless it dissects the stack trace. Pushing the text would in any case be cleaner. There is the exception message - using that, localized - seems a bit messy. I probably overlooked something. What did you have in mind? |
As long as it is serializable you can add anything to custom exceptions, including e.g. resource ids. |
That sounds interesting. I'll keep it in mind. Thank you. If you happen to know where I could find an example for such a class, a pointer would be great. |
import android.support.annotation.StringRes;
/**
* @author F43nd1r
* @since 27.09.2016
*/
public class BaseException extends Exception {
@StringRes
private final int msgId;
public BaseException(@StringRes int msgId) {
this.msgId = msgId;
}
public BaseException(String message, @StringRes int msgId) {
super(message);
this.msgId = msgId;
}
public BaseException(String message, Throwable cause, @StringRes int msgId) {
super(message, cause);
this.msgId = msgId;
}
public BaseException(Throwable cause, @StringRes int msgId) {
super(cause);
this.msgId = msgId;
}
@StringRes
public int getMsgId() {
return msgId;
}
} |
OK, seems straightforward. :) Thank you very much! |
perform #421 (comment)
ACRAConfiguration
now only contains the logic ofcheckCrashResources
. Maybe this could move somewhere else, so that it is only a configuration object and nothing else?