From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/17403 Path: main.gmane.org!not-for-mail From: Jan Vroonhof Newsgroups: gmane.emacs.gnus.general Subject: Re: pgnus-0.31: invoke external MIME stuff Date: 25 Sep 1998 13:15:56 +0200 Sender: owner-ding@hpc.uh.edu Message-ID: References: <5b90jastbh.fsf@gin.cs.rochester.edu> NNTP-Posting-Host: coloc-standby.netfonds.no X-Trace: main.gmane.org 1035156110 748 80.91.224.250 (20 Oct 2002 23:21:50 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 23:21:50 +0000 (UTC) Return-Path: Original-Received: from gizmo.hpc.uh.edu (gizmo.hpc.uh.edu [129.7.102.31]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id HAA08718 for ; Fri, 25 Sep 1998 07:16:39 -0400 (EDT) Original-Received: from sina.hpc.uh.edu (sina.hpc.uh.edu [129.7.3.5]) by gizmo.hpc.uh.edu (8.7.6/8.7.3) with ESMTP id FAF10934; Fri, 25 Sep 1998 05:47:37 -0500 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Fri, 25 Sep 1998 06:16:20 -0500 (CDT) Original-Received: from sclp3.sclp.com (root@sclp3.sclp.com [209.195.19.139]) by sina.hpc.uh.edu (8.7.3/8.7.3) with ESMTP id GAA14052 for ; Fri, 25 Sep 1998 06:16:08 -0500 (CDT) Original-Received: from frege.math.ethz.ch (root@frege-d-math-north-g-west.math.ethz.ch [129.132.145.3]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id HAA08710 for ; Fri, 25 Sep 1998 07:16:01 -0400 (EDT) Original-Received: from bolzano (vroonhof@bolzano [129.132.146.140]) by frege.math.ethz.ch (8.8.8/Main-STAT-mailer) with ESMTP id NAA26945 for ; Fri, 25 Sep 1998 13:15:16 +0200 (MET DST) Original-Received: (vroonhof@localhost) by bolzano (SMI-8.6/D-MATH-client) id NAA24203; Fri, 25 Sep 1998 13:15:56 +0200 Original-To: ding@gnus.org In-Reply-To: Lars Magne Ingebrigtsen's message of "Thu, 24 Sep 1998 20:53:38 GMT" Original-Lines: 72 User-Agent: Gnus/5.070032 (Pterodactyl Gnus v0.32) XEmacs/21.0 (Norwegian) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:17403 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:17403 Lars Magne Ingebrigtsen writes: > > > No -- base64 throws errors is the region in question isn't a valid > > > base64 file, if I recall correctly. > > > > Shouldn't you be catching JUST that error? > > How does one catch an error thrown by `error' and no other errors? One fixes the library (in this case base-64.el) to signal a more specialised error, like this (condition-case () (base64-decode-region (point-min) (point-max)) (mime-conversion-error nil)) diff -u /u/scratch/vroonhof/xemacs/gnus/pgnus-0.32/lisp/base64.el~ /u/scratch/vroonhof/xemacs/gnus/pgnus-0.32/lisp/base64.el --- /u/scratch/vroonhof/xemacs/gnus/pgnus-0.32/lisp/base64.el~ Fri Sep 25 13:14:06 1998 +++ /u/scratch/vroonhof/xemacs/gnus/pgnus-0.32/lisp/base64.el Fri Sep 25 13:14:06 1998 @@ -29,6 +29,16 @@ (if (not (fboundp 'char-int)) (fset 'char-int 'identity)) +(define-error 'mime-conversion-error "Error in coverting encoded data.") +; As data we return (list ) where units is 'bits +(define-error 'mime-short-coding-string + "The encoded string is short" + 'mime-conversion-error) +(define-error 'mime-external-program-error + "External conversion program error" + 'mime-conversion-error) + + (defvar base64-alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/") @@ -134,7 +144,7 @@ base64-decoder-program base64-decoder-switches))) (if (not (eq status t)) - (error "%s" (cdr status)))) + (signal-error 'mime-external-program-error (cdr status)))) (goto-char start) (skip-chars-forward non-data-chars end) (while (not done) @@ -159,13 +169,13 @@ (cond ((= (point) end) (if (not (zerop counter)) - (error "at least %d bits missing at end of base64 encoding" - (* (- 4 counter) 6))) + (signal-error 'mime-short-coding-string + (list (* (- 4 counter) 6) 'bits))) (setq done t)) ((= (char-after (point)) ?=) (setq done t) (cond ((= counter 1) - (error "at least 2 bits missing at end of base64 encoding")) + (signal-error 'mime-short-coding-string '(2 bits)) ((= counter 2) (base64-insert-char (lsh bits -10) 1 nil work-buffer)) ((= counter 3) @@ -201,7 +211,7 @@ base64-encoder-program base64-encoder-switches))) (if (not (eq status t)) - (error "%s" (cdr status)))) + (signal-error 'mime-external-program-error (list (cdr status))))) (setq inputpos start) (while (< inputpos end) (setq bits (+ bits (char-int (char-after inputpos))))