Revision: 5178
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5178&view=rev
Author:   hofman
Date:     2009-01-28 12:37:13 +0000 (Wed, 28 Jan 2009)

Log Message:
-----------
Declare error codes and error domain for skim notes framework

Modified Paths:
--------------
    trunk/SkimNotes/SKNExtendedAttributeManager.h
    trunk/SkimNotes/SKNExtendedAttributeManager.m

Modified: trunk/SkimNotes/SKNExtendedAttributeManager.h
===================================================================
--- trunk/SkimNotes/SKNExtendedAttributeManager.h       2009-01-28 11:13:52 UTC 
(rev 5177)
+++ trunk/SkimNotes/SKNExtendedAttributeManager.h       2009-01-28 12:37:13 UTC 
(rev 5178)
@@ -63,8 +63,26 @@
 };
 typedef int SKNXattrFlags;
 
+/*!
+    @discussion  Error domain for the extended attribute manager used for 
non-POSIX errors.
+*/
+extern NSString *SKNSkimNotesErrorDomain;
 
 /*!
+    @enum        SKNErrorCodes 
+    @abstract    Error codes in the SKNSkimNotesErrorDomain.
+    @discussion  These error codes are the non-POSIX errors returned by the 
extended attribute manager.  Apart from these, also errors from 
NSPOSIXErrorDomain can be returned.
+    @constant    SKNReassembleAttributeFailedError  Fragments could not be 
reassembled to a combined value.
+    @constant    SKNPlistSerializationFailedError   Property list 
serialization failed. Uses the description from NSPropertyListSerialization.
+    @constant    SKNPlistDeserializationFailedError Property list 
deserialization failed. Uses the description from NSPropertyListSerialization.
+*/
+enum {
+    SKNReassembleAttributeFailedError  = 1,
+    SKNPlistSerializationFailedError   = 2,
+    SKNPlistDeserializationFailedError = 3
+};
+
+/*!
     @abstract    Provides an Objective-C wrapper for the low-level BSD 
functions dealing with file attributes.
     @discussion  This class is the core object to read and write extended 
attributes, which are used to store Skim notes with PDF files.
 */

Modified: trunk/SkimNotes/SKNExtendedAttributeManager.m
===================================================================
--- trunk/SkimNotes/SKNExtendedAttributeManager.m       2009-01-28 11:13:52 UTC 
(rev 5177)
+++ trunk/SkimNotes/SKNExtendedAttributeManager.m       2009-01-28 12:37:13 UTC 
(rev 5178)
@@ -49,7 +49,7 @@
 #define WRAPPER_KEY_SUFFIX      @"_has_wrapper"
 #define FRAGMENTS_KEY_SUFFIX    @"_number_of_fragments"
 
-static NSString *SKNErrorDomain = @"SKNErrorDomain";
+NSString *SKNSkimNotesErrorDomain = @"SKNSkimNotesErrorDomain";
 
 @interface SKNExtendedAttributeManager (SKNPrivate)
 // private methods to (un)compress data
@@ -263,7 +263,7 @@
         [attribute release];
         attribute = success ? [[self bunzipData:buffer] retain] : nil;
         
-        if (success == NO && NULL != error) *error = [NSError 
errorWithDomain:SKNErrorDomain code:0 userInfo:[NSDictionary 
dictionaryWithObjectsAndKeys:path, NSFilePathErrorKey, 
SKNLocalizedString(@"Failed to reassemble attribute value.", @"Error 
description"), NSLocalizedDescriptionKey, nil]];
+        if (success == NO && NULL != error) *error = [NSError 
errorWithDomain:SKNSkimNotesErrorDomain code:SKNReassembleAttributeFailedError 
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:path, NSFilePathErrorKey, 
SKNLocalizedString(@"Failed to reassemble attribute value.", @"Error 
description"), NSLocalizedDescriptionKey, nil]];
     }
     return [attribute autorelease];
 }
@@ -286,7 +286,7 @@
                                                            format:NULL 
                                                  
errorDescription:&errorString];
         if (nil == plist) {
-            if (error) *error = [NSError errorWithDomain:SKNErrorDomain code:0 
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:path, NSFilePathErrorKey, 
errorString, NSLocalizedDescriptionKey, nil]];
+            if (error) *error = [NSError 
errorWithDomain:SKNSkimNotesErrorDomain code:SKNPlistDeserializationFailedError 
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:path, NSFilePathErrorKey, 
errorString, NSLocalizedDescriptionKey, nil]];
             [errorString release];
         }
     }
@@ -368,7 +368,7 @@
                                                     
errorDescription:&errorString];
     BOOL success;
     if (nil == data) {
-        if (error) *error = [NSError errorWithDomain:SKNErrorDomain code:0 
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:path, NSFilePathErrorKey, 
errorString, NSLocalizedDescriptionKey, nil]];
+        if (error) *error = [NSError errorWithDomain:SKNSkimNotesErrorDomain 
code:SKNPlistDeserializationFailedError userInfo:[NSDictionary 
dictionaryWithObjectsAndKeys:path, NSFilePathErrorKey, errorString, 
NSLocalizedDescriptionKey, nil]];
         [errorString release];
         success = NO;
     } else {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to