Starscream.WSError Error 1

Created on 5 Sep 2019  路  2Comments  路  Source: daltoniam/Starscream

I use socektio-swift to do socket connection. But some online users always can not create a socket connection. I print the log which says "Starscream.WSError Error 1". I find socketio-swift use your library. So any advises about this error.

Most of the users are good. Only a few ones get this error. And whatever they do, kill the app, restart the device, all no helpful.

Most helpful comment

This is a stupid library, and you can't even say I m working on it. Fuck you, sincerely

All 2 comments

This is a stupid library, and you can't even say I m working on it. Fuck you, sincerely

@AlphaJian needs to check their entitlement, but for anyone hitting this from Google...

The issue is that WSError always gets logged as error 1 because it doesn't adopt either CustomNSError or LocalizedError. I'm not sure if it should adopt LocalizedError at least with the current descriptions it provides since they aren't directed towards end users, but here's what it would look like:

// public enum ErrorType: String, Error { ...

public struct WSError: Error, CustomNSError, LocalizedError {
    public let type: ErrorType
    public let message: String
    public let code: Int

    public var errorDescription: String? {
        return message
    }

    public var errorCode: Int {
        return code
    }

    public var errorUserInfo: [String: Any] {
        [
            "type": type.rawValue
        ]
    }
}

Services like Crashlytics use errorUserInfo so it's always good to map error details into that format.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AdamMak picture AdamMak  路  3Comments

xjimi picture xjimi  路  4Comments

felipeflorencio picture felipeflorencio  路  4Comments

adrian-niculescu picture adrian-niculescu  路  4Comments

LondonAtlas picture LondonAtlas  路  3Comments