OpenAPITools / OpenAPITools/openapi-generator

[SWIFT4] How to handle Error

Open
#2,805 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

My code looks like this:

  AuthAPI.login(loginRequest: request) { (response : LoginResponse?, error :  Error?) in
            if error != nil {
                
            }
            
            if response != nil {
                if response!.result.success {
                    self.loginSuccess(data: response!.result.data!)
                }
            }
        }

How can i get the http status code from error if there is one ?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated Swift 4 AuthAPI.login entry point shown in the issue and inspect the callback's Error type and response handling. No generated file or test is named; done would be a documented, verified way to access the HTTP status code, or a clear statement that the client does not expose it.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
api
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.