-
public final class OneSignalErrorDescribes why a OneSignal call failed.
One request can fail for several reasons at once, so details is a list of Detail. Everything the SDK raises locally has exactly one reason, which first reads without the indexing ceremony.
On the wire this is the list itself, sitting under the envelope's
errorkey:{ "success": false, "data": null, "error": [ { "code": "STORAGE_LOCKED", "source": "CLIENT", "backendCode": null, "message": "..." } ] }Construct through of or fromWire. The internal companion is still reachable from Java, so the never-empty invariant is enforced in
init, not by visibility.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classOneSignalError.DetailA single reason a call failed.
Nested rather than top-level so the name cannot collide with
kotlin.Error, which is auto-imported everywhere, or shadowjava.lang.Errorin a Java file that imports it.
-
Field Summary
Fields Modifier and Type Field Description private final List<OneSignalError.Detail>detailsprivate final OneSignalError.Detailfirstprivate final Throwablecause
-
Method Summary
Modifier and Type Method Description final List<OneSignalError.Detail>getDetails()Why the call failed. final OneSignalError.DetailgetFirst()final ThrowablegetCause()The throwable behind the failure, when there was one. final List<Map<String, Object>>toList()Projects this error onto the cross-SDK wire shape consumed by the wrapper bridges. StringtoString()-
-
Method Detail
-
getDetails
final List<OneSignalError.Detail> getDetails()
Why the call failed. Never empty.
Copied so a caller holding the original list cannot empty it afterwards, and unmodifiable so the copy itself cannot be emptied either. Java sees a plain
Listandclear()is one keystroke away fromget(); both would leave first throwing.
-
getFirst
final OneSignalError.Detail getFirst()
-
getCause
final Throwable getCause()
The throwable behind the failure, when there was one.
Deliberately absent from toList: a stack trace cannot cross the wrapper bridges, and the wire schema has to stay identical across every SDK. This exists so that native Kotlin and Java callers do not lose the stack when the suspend APIs report a failure instead of throwing it.
-
toList
final List<Map<String, Object>> toList()
Projects this error onto the cross-SDK wire shape consumed by the wrapper bridges.
-
-
-
-