Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/benarvin/baerror
Helper category for NSError, mark details of NSError more effective.
https://github.com/benarvin/baerror
nserror objective-c
Last synced: 4 days ago
JSON representation
Helper category for NSError, mark details of NSError more effective.
- Host: GitHub
- URL: https://github.com/benarvin/baerror
- Owner: BenArvin
- License: mit
- Created: 2020-07-17T07:02:43.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-02-22T09:16:32.000Z (over 3 years ago)
- Last Synced: 2024-04-18T11:12:38.164Z (7 months ago)
- Topics: nserror, objective-c
- Language: Objective-C
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BAError
[![CI Status](https://img.shields.io/travis/benarvin/BAError.svg?style=flat)](https://travis-ci.org/benarvin/BAError)
[![Version](https://img.shields.io/cocoapods/v/BAError.svg?style=flat)](https://cocoapods.org/pods/BAError)
[![License](https://img.shields.io/cocoapods/l/BAError.svg?style=flat)](https://cocoapods.org/pods/BAError)
[![Platform](https://img.shields.io/cocoapods/p/BAError.svg?style=flat)](https://cocoapods.org/pods/BAError)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](https://cocoapods.org). To install
it, simply add the following line to your Podfile:```ruby
pod 'BAError'
```## Author
benarvin, [email protected]
## License
BAError is available under the MIT license. See the LICENSE file for more info.