-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement ErrorReceivers support (#45)
* Implement TryOnError support This implements support for trying delegate onError calls if they opt in by implementing a new `TryOnError` interface. This will likely need to rely on guarded delegate call machinery, and need to figure out whether that should be another config or just supersede/defer to the existing config. Resolves #24 * Split reportError and createError * Add DeliverModifiedException marker type * Update observers for new DeliverModifiedException API * Rename new marker interfaces TryOnError -> RxDogTagErrorReceiver DeliverModifiedException -> RxDogTagModifiedExceptionReceiver * Rename new marker interfaces TryOnError -> RxDogTagErrorReceiver DeliverModifiedException -> RxDogTagModifiedExceptionReceiver * Spotless * Spotless
- Loading branch information
Showing
10 changed files
with
333 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
rxdogtag/src/main/java/com/uber/rxdogtag/RxDogTagErrorReceiver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright (C) 2019. Uber Technologies | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.uber.rxdogtag; | ||
|
||
import io.reactivex.annotations.NonNull; | ||
|
||
/** | ||
* A marker type to indicate that RxDogTag's decorating observers should try the onError() of the | ||
* delegate of the observer that implements this. | ||
*/ | ||
public interface RxDogTagErrorReceiver { | ||
/** | ||
* Called once if the deferred computation 'throws' an exception. | ||
* | ||
* @param e the exception, not null. | ||
*/ | ||
void onError(@NonNull Throwable e); | ||
} |
32 changes: 32 additions & 0 deletions
32
rxdogtag/src/main/java/com/uber/rxdogtag/RxDogTagTaggedExceptionReceiver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (C) 2019. Uber Technologies | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.uber.rxdogtag; | ||
|
||
import io.reactivex.exceptions.OnErrorNotImplementedException; | ||
|
||
/** | ||
* A marker type to indicate that RxDogTag's should pass the decorated stacktrace to {@link | ||
* #onError(Throwable)}. Note that this will always be tried directly, and no guarded delegate | ||
* behavior will be attempted even if {@link RxDogTag.Builder#guardObserverCallbacks(boolean)} is | ||
* enabled in configuration. | ||
* | ||
* <p><em>NOTE:</em> RxDogTag exceptions are always {@link OnErrorNotImplementedException | ||
* OnErrorNotImplementedExceptions}, as these have special behavior as an escape hatch in RxJava | ||
* internals. This exception will have no "cause" property if the original exception was not already | ||
* an {@link OnErrorNotImplementedException}. If it was, which is unusual, it is reused with its | ||
* original cause (if any) and has its stacktrace modified. | ||
*/ | ||
public interface RxDogTagTaggedExceptionReceiver extends RxDogTagErrorReceiver {} |
Oops, something went wrong.