Package 

Class OneSignalError


  • 
    public final class OneSignalError
    
                        

    Describes 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 error key:

    { "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.

    • 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 List and clear() is one keystroke away from get(); both would leave first throwing.

      • 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.