* mixi.el (mixi-realization-error): New error symbol.
authorbg66 <bg66>
Fri, 22 Dec 2006 02:17:38 +0000 (02:17 +0000)
committerbg66 <bg66>
Fri, 22 Dec 2006 02:17:38 +0000 (02:17 +0000)
(mixi-realization-error): New macro.
(mixi-realize-friend): Use it.
(mixi-realize-diary): Ditto.
(mixi-realize-community): Ditto.
(mixi-realize-topic): Ditto.
(mixi-realize-event): Ditto.
(mixi-realize-message): Ditto.

ChangeLog
mixi.el

index a994741..daf4d76 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2006-12-22  OHASHI Akira  <bg66@koka-in.org>
 
+       * mixi.el (mixi-realization-error): New error symbol.
+       (mixi-realization-error): New macro.
+       (mixi-realize-friend): Use it.
+       (mixi-realize-diary): Ditto.
+       (mixi-realize-community): Ditto.
+       (mixi-realize-topic): Ditto.
+       (mixi-realize-event): Ditto.
+       (mixi-realize-message): Ditto.
+
+2006-12-22  OHASHI Akira  <bg66@koka-in.org>
+
        * mixi.el (mixi-get-friends): Rename ARGS argument to FRIEND-OR-RANGE.
        (mixi-get-diaries): Ditto.
        (mixi-get-communities): Ditto.
diff --git a/mixi.el b/mixi.el
index b119fa2..6c08005 100644 (file)
--- a/mixi.el
+++ b/mixi.el
@@ -206,6 +206,14 @@ Increase this value when unexpected error frequently occurs."
 (defmacro mixi-message (&rest strings)
   `(concat "[mixi] " ,@strings))
 
+(put 'mixi-realization-error
+     'error-message (mixi-message "Cannot realize object"))
+(put 'mixi-realization-error
+     'error-conditions '(mixi-realization-error error))
+
+(defmacro mixi-realization-error (type object)
+  `(signal 'mixi-realization-error (list ,type ,object buffer)))
+
 (defconst mixi-message-adult-contents
   "¤³¤Î¥Ú¡¼¥¸¤«¤éÀè¤Ï¥¢¥À¥ë¥È¡ÊÀ®¿Í¸þ¤±¡Ë¥³¥ó¥Æ¥ó¥Ä¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£<br>
 ±ÜÍ÷¤ËƱ°Õ¤µ¤ì¤¿Êý¤Î¤ß¡¢Àè¤Ø¤ª¿Ê¤ß¤¯¤À¤µ¤¤¡£")
@@ -710,7 +718,7 @@ Increase this value when unexpected error frequently occurs."
        (setq buf buffer))
       (if (string-match mixi-friend-nick-regexp buf)
          (mixi-friend-set-nick friend (match-string 1 buf))
-       (signal 'error (list 'cannot-find-nick friend)))
+       (mixi-realization-error 'cannot-find-nick friend))
       ;; For getting my profile.
       (unless (string-match mixi-friend-name-regexp buf)
        (with-mixi-retrieve (concat "/show_profile.pl?id="
@@ -718,12 +726,12 @@ Increase this value when unexpected error frequently occurs."
          (setq buf buffer)))
       (if (string-match mixi-friend-name-regexp buf)
            (mixi-friend-set-name friend (match-string 2 buf))
-       (signal 'error (list 'cannot-find-name friend)))
+       (mixi-realization-error 'cannot-find-name friend))
       (if (string-match mixi-friend-sex-regexp buf)
          (mixi-friend-set-sex friend
                               (if (string= (match-string 3 buf) "ÃË")
                                   'male 'female))
-       (signal 'error (list 'cannot-find-sex friend)))
+       (mixi-realization-error 'cannot-find-sex friend))
       (when (string-match mixi-friend-address-regexp buf)
        (mixi-friend-set-address friend (match-string 1 buf)))
       (when (string-match mixi-friend-age-regexp buf)
@@ -1060,7 +1068,7 @@ Increase this value when unexpected error frequently occurs."
        (if (string-match mixi-diary-owner-nick-regexp buffer)
            (mixi-friend-set-nick (mixi-diary-owner diary)
                                  (match-string 1 buffer))
-         (signal 'error (list 'cannot-find-owner-nick diary)))
+         (mixi-realization-error 'cannot-find-owner-nick diary))
        (if (string-match mixi-diary-time-regexp buffer)
            (mixi-diary-set-time
             diary (encode-time 0 (string-to-number (match-string 10 buffer))
@@ -1068,13 +1076,13 @@ Increase this value when unexpected error frequently occurs."
                                (string-to-number (match-string 7 buffer))
                                (string-to-number (match-string 6 buffer))
                                (string-to-number (match-string 5 buffer))))
-         (signal 'error (list 'cannot-find-time diary)))
+         (mixi-realization-error 'cannot-find-time diary))
        (if (string-match mixi-diary-title-regexp buffer)
            (mixi-diary-set-title diary (match-string 2 buffer))
-         (signal 'error (list 'cannot-find-title diary)))
+         (mixi-realization-error 'cannot-find-title diary))
        (if (string-match mixi-diary-content-regexp buffer)
            (mixi-diary-set-content diary (match-string 2 buffer))
-         (signal 'error (list 'cannot-find-content diary)))))
+         (mixi-realization-error 'cannot-find-content diary))))
     (mixi-object-touch diary)))
 
 (defun mixi-diary-owner (diary)
@@ -1250,37 +1258,37 @@ Increase this value when unexpected error frequently occurs."
          (mixi-community-set-name community "¥Ç¡¼¥¿¤¬¤¢¤ê¤Þ¤»¤ó")
        (if (string-match mixi-community-name-regexp buffer)
            (mixi-community-set-name community (match-string 1 buffer))
-         (signal 'error (list 'cannot-find-name community)))
+         (mixi-realization-error 'cannot-find-name community))
        (if (string-match mixi-community-birthday-regexp buffer)
            (mixi-community-set-birthday
             community
             (encode-time 0 0 0 (string-to-number (match-string 3 buffer))
                          (string-to-number (match-string 2 buffer))
                          (string-to-number (match-string 1 buffer))))
-         (signal 'error (list 'cannot-find-birthday community)))
+         (mixi-realization-error 'cannot-find-birthday community))
        (if (string-match mixi-community-owner-regexp buffer)
            (if (string= (match-string 1 buffer) "home.pl")
                (mixi-community-set-owner community (mixi-make-me))
              (mixi-community-set-owner
               community (mixi-make-friend (match-string 2 buffer)
                                           (match-string 3 buffer))))
-         (signal 'error (list 'cannot-find-owner community)))
+         (mixi-realization-error 'cannot-find-owner community))
        (if (string-match mixi-community-category-regexp buffer)
            (mixi-community-set-category community (match-string 1 buffer))
-         (signal 'error (list 'cannot-find-category community)))
+         (mixi-realization-error 'cannot-find-category community))
        (if (string-match mixi-community-members-regexp buffer)
            (mixi-community-set-members
             community (string-to-number (match-string 1 buffer)))
-         (signal 'error (list 'cannot-find-members community)))
+         (mixi-realization-error 'cannot-find-members community))
        (if (string-match mixi-community-open-level-regexp buffer)
            (mixi-community-set-open-level community (match-string 1 buffer))
-         (signal 'error (list 'cannot-find-open-level community)))
+         (mixi-realization-error 'cannot-find-open-level community))
        (if (string-match mixi-community-authority-regexp buffer)
            (mixi-community-set-authority community (match-string 1 buffer))
-         (signal 'error (list 'cannot-find-authority community)))
+         (mixi-realization-error 'cannot-find-authority community))
        (if (string-match mixi-community-description-regexp buffer)
            (mixi-community-set-description community (match-string 1 buffer))
-         (signal 'error (list 'cannot-find-description community)))))
+         (mixi-realization-error 'cannot-find-description community))))
     (mixi-object-touch community)))
 
 (defun mixi-community-id (community)
@@ -1496,7 +1504,7 @@ Increase this value when unexpected error frequently occurs."
       (if (string-match mixi-topic-community-regexp buffer)
          (mixi-community-set-name (mixi-topic-community topic)
                                   (match-string 1 buffer))
-       (signal 'error (list 'cannot-find-community topic)))
+       (mixi-realization-error 'cannot-find-community topic))
       (if (string-match mixi-topic-time-regexp buffer)
          (mixi-topic-set-time
           topic (encode-time 0 (string-to-number (match-string 5 buffer))
@@ -1504,18 +1512,18 @@ Increase this value when unexpected error frequently occurs."
                              (string-to-number (match-string 3 buffer))
                              (string-to-number (match-string 2 buffer))
                              (string-to-number (match-string 1 buffer))))
-       (signal 'error (list 'cannot-find-time topic)))
+       (mixi-realization-error 'cannot-find-time topic))
       (if (string-match mixi-topic-title-regexp buffer)
          (mixi-topic-set-title topic (match-string 1 buffer))
-       (signal 'error (list 'cannot-find-title topic)))
+       (mixi-realization-error 'cannot-find-title topic))
       (if (string-match mixi-topic-owner-regexp buffer)
          (mixi-topic-set-owner topic
                                (mixi-make-friend (match-string 1 buffer)
                                                  (match-string 2 buffer)))
-       (signal 'error (list 'cannot-find-owner topic)))
+       (mixi-realization-error 'cannot-find-owner topic))
       (if (string-match mixi-topic-content-regexp buffer)
          (mixi-topic-set-content topic (match-string 2 buffer))
-       (signal 'error (list 'cannot-find-content topic))))
+       (mixi-realization-error 'cannot-find-content topic)))
     (mixi-object-touch topic)))
 
 (defun mixi-topic-community (topic)
@@ -1652,7 +1660,7 @@ Increase this value when unexpected error frequently occurs."
       (if (string-match mixi-event-community-regexp buffer)
          (mixi-community-set-name (mixi-event-community event)
                                   (match-string 1 buffer))
-       (signal 'error (list 'cannot-find-title event)))
+       (mixi-realization-error 'cannot-find-title event))
       (if (string-match mixi-event-time-regexp buffer)
          (mixi-event-set-time
           event (encode-time 0 (string-to-number (match-string 5 buffer))
@@ -1660,24 +1668,24 @@ Increase this value when unexpected error frequently occurs."
                              (string-to-number (match-string 3 buffer))
                              (string-to-number (match-string 2 buffer))
                              (string-to-number (match-string 1 buffer))))
-       (signal 'error (list 'cannot-find-time event)))
+       (mixi-realization-error 'cannot-find-time event))
       (if (string-match mixi-event-title-regexp buffer)
          (mixi-event-set-title event (match-string 1 buffer))
-       (signal 'error (list 'cannot-find-title event)))
+       (mixi-realization-error 'cannot-find-title event))
       (if (string-match mixi-event-owner-regexp buffer)
          (mixi-event-set-owner event
                                (mixi-make-friend (match-string 1 buffer)
                                                  (match-string 2 buffer)))
-       (signal 'error (list 'cannot-find-owner event)))
+       (mixi-realization-error 'cannot-find-owner event))
       (if (string-match mixi-event-date-regexp buffer)
          (mixi-event-set-date event (match-string 1 buffer))
-       (signal 'error (list 'cannot-find-date event)))
+       (mixi-realization-error 'cannot-find-date event))
       (if (string-match mixi-event-place-regexp buffer)
          (mixi-event-set-place event (match-string 1 buffer))
-       (signal 'error (list 'cannot-find-place event)))
+       (mixi-realization-error 'cannot-find-place event))
       (if (string-match mixi-event-detail-regexp buffer)
          (mixi-event-set-detail event (match-string 1 buffer))
-       (signal 'error (list 'cannot-find-detail event)))
+       (mixi-realization-error 'cannot-find-detail event))
       (when (string-match mixi-event-limit-regexp buffer)
        (mixi-event-set-limit
         event (encode-time 0 0 0 (string-to-number (match-string 3 buffer))
@@ -1685,7 +1693,7 @@ Increase this value when unexpected error frequently occurs."
                            (string-to-number (match-string 1 buffer)))))
       (if (string-match mixi-event-members-regexp buffer)
          (mixi-event-set-members event (match-string 1 buffer))
-       (signal 'error (list 'cannot-find-members event))))
+       (mixi-realization-error 'cannot-find-members event)))
     (mixi-object-touch event)))
 
 (defun mixi-event-community (event)
@@ -2122,10 +2130,10 @@ Increase this value when unexpected error frequently occurs."
          (mixi-message-set-owner message
                                  (mixi-make-friend (match-string 2 buffer)
                                                    (match-string 3 buffer)))
-       (signal 'error (list 'cannot-find-owner message)))
+       (mixi-realization-error 'cannot-find-owner message))
       (if (string-match mixi-message-title-regexp buffer)
          (mixi-message-set-title message (match-string 2 buffer))
-       (signal 'error (list 'cannot-find-title message)))
+       (mixi-realization-error 'cannot-find-title message))
       (if (string-match mixi-message-time-regexp buffer)
          (mixi-message-set-time
           message (encode-time 0 (string-to-number (match-string 6 buffer))
@@ -2133,10 +2141,10 @@ Increase this value when unexpected error frequently occurs."
                                (string-to-number (match-string 4 buffer))
                                (string-to-number (match-string 3 buffer))
                                (string-to-number (match-string 2 buffer))))
-       (signal 'error (list 'cannot-find-time message)))
+       (mixi-realization-error 'cannot-find-time message))
       (if (string-match mixi-message-content-regexp buffer)
          (mixi-message-set-content message (match-string 1 buffer))
-       (signal 'error (list 'cannot-find-content message))))
+       (mixi-realization-error 'cannot-find-content message)))
     (mixi-object-touch message)))
 
 (defun mixi-message-id (message)