Skip to content

Helper category for NSError, mark details of NSError more effective.

License

Notifications You must be signed in to change notification settings

BenArvin/BAError

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BAError

CI Status Version License Platform

Helper category for NSError, mark details of NSError more effective.

BAError help you build NSError easily. And you can get more specific description by call localizedDescription, and readable details chain by call localizedFailureReason, localizedRecoverySuggestion.

For example:

NSError *error1 = [NSError bae_errorWith:@"TestDomain" code:1001 description:@"testDes_1" causes:nil];
NSError *error2 = [NSError bae_errorWith:@"TestDomain" code:1002 description:@"testDes_2" causes:error1, nil];
NSLog(@"%@", error2.localizedDescription);
NSLog(@"%@", error2.localizedFailureReason);
NSLog(@"%@", error2.localizedRecoverySuggestion);

You'll find jsonlized and continuous detail of NSError in console:

  • Localized description:
[TestDomain-1002] testDes_2

  • Localized failure reason & Localized recovery suggestion
{
  "Domain" : "TestDomain",
  "Description" : "testDes_2",
  "Causes" : [
    {
      "Domain" : "TestDomain",
      "Code" : 1001,
      "Description" : "testDes_1"
    }
  ],
  "Code" : 1002
}

Installation

BAError is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'BAError'

Author

benarvin, benarvin93@outlook.com

License

BAError is available under the MIT license. See the LICENSE file for more info.

About

Helper category for NSError, mark details of NSError more effective.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published