mirror of
https://github.com/ish-app/ish.git
synced 2026-05-28 21:10:35 +00:00
27 lines
731 B
Objective-C
27 lines
731 B
Objective-C
//
|
|
// NSError+ISHErrno.m
|
|
// iSH
|
|
//
|
|
// Created by Theodore Dubois on 12/15/18.
|
|
//
|
|
|
|
#import <FileProvider/FileProvider.h>
|
|
#import "NSError+ISHErrno.h"
|
|
#include "kernel/errno.h"
|
|
|
|
@implementation NSError (ISHErrno)
|
|
|
|
+ (NSError *)errorWithISHErrno:(long)err itemIdentifier:(nonnull NSFileProviderItemIdentifier)identifier {
|
|
switch (err) {
|
|
case _ENOENT:
|
|
return [NSError fileProviderErrorForNonExistentItemWithIdentifier:identifier];
|
|
}
|
|
return [NSError errorWithDomain:ISHErrnoDomain
|
|
code:err
|
|
userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:@"error code %ld", err]}];
|
|
}
|
|
|
|
@end
|
|
|
|
NSString *const ISHErrnoDomain = @"ISHErrnoDomain";
|