diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-06-15 15:38:27 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-06-15 15:38:27 +0300 |
commit | 516f479a1ddb3bb783a01e9ffb20ba051243ffd0 (patch) | |
tree | baa64c57bf1cc11bed2bd894d75cd605e21c3ff9 /src/ellinika | |
parent | 3340ce32eb576ff355b83fc78a189b897b7fc424 (diff) | |
download | ellinika-516f479a1ddb3bb783a01e9ffb20ba051243ffd0.tar.gz ellinika-516f479a1ddb3bb783a01e9ffb20ba051243ffd0.tar.bz2 |
Improve error handling in conj.
* src/cgi-bin/conj.scm4: Add error handling.
* src/ellinika/conjugator.scm: Throw 'conjugator-error
instead of calling (error).
* src/ellinika/elmorph.c: Use ~A in error messages when referring to
elstrs. Guile's ~S sucks on UTF-8.
* src/ellinika/utf8scm.c: Likewise.
* style.css (.error): Output in red.
Diffstat (limited to 'src/ellinika')
-rw-r--r-- | src/ellinika/conjugator.scm | 6 | ||||
-rw-r--r-- | src/ellinika/elmorph.c | 28 | ||||
-rw-r--r-- | src/ellinika/utf8scm.c | 8 |
3 files changed, 22 insertions, 20 deletions
diff --git a/src/ellinika/conjugator.scm b/src/ellinika/conjugator.scm index 41575c2..8172686 100644 --- a/src/ellinika/conjugator.scm +++ b/src/ellinika/conjugator.scm @@ -180,3 +180,4 @@ WHERE verb=\"~A\" AND voice=\"~A\" AND thema=\"~A\"" (else - (error "cannot handle ~A~%" verb)))) + (throw 'conjugator-error 'conjugator-error-input + "cannot handle ~A" (list (force-string verb)))))) @@ -419,3 +420,4 @@ AND c.tense=\"~A\" AND c.flect = f.ident ORDER by fold" (else - (error "invalid accent character" acc)))) + (throw 'conjugator-error 'conjugator-error-db + "invalid accent character ~A" (list acc))))) (conj-info #:flect conj) diff --git a/src/ellinika/elmorph.c b/src/ellinika/elmorph.c index 56bead3..90a156d 100644 --- a/src/ellinika/elmorph.c +++ b/src/ellinika/elmorph.c @@ -267,3 +267,3 @@ force_elstr(struct elstr **ep, SCM scm, int sylopt, scm_misc_error(func_name, - "Invalid input string: ~S", + "Invalid input string: ~A", scm_list_1(scm)); @@ -359,3 +359,3 @@ SCM_DEFINE_PUBLIC(scm_elstr_syllable_prop, "elstr-syllable-prop", "cannot get syllable #~S: not enough syllables: ~S", - scm_list_2(el, n)); + scm_list_2(n, el)); num = elstr->nsyl - num; @@ -408,3 +408,3 @@ SCM_DEFINE_PUBLIC(scm_elstr_syllable, "elstr-syllable", "cannot get syllable #~S: not enough syllables: ~S", - scm_list_2(el, n)); + scm_list_2(n, el)); num = elstr->nsyl - num; @@ -439,3 +439,3 @@ SCM_DEFINE_PUBLIC(scm_elstr_character, "elstr-character", "cannot get character #~S: not enough characters: ~S", - scm_list_2(el, n)); + scm_list_2(n, el)); len = utf8_wctomb(r, elstr->str[num]); @@ -576,3 +576,3 @@ _elstr_set_accent(SCM el, SCM n, int destructive, const char *func_name) scm_misc_error(func_name, - "cannot set accent on syllable #~S: not enough syllables: ~S", + "cannot set accent on syllable #~S: not enough syllables: ~A", scm_list_2(n, el)); @@ -609,3 +609,3 @@ _elstr_set_accent(SCM el, SCM n, int destructive, const char *func_name) scm_misc_error(func_name, - "cannot set accent on syllable #~S of ~S: " + "cannot set accent on syllable #~S of ~A: " "INTERNAL ERROR", @@ -661,8 +661,8 @@ _elstr_set_accent_on_char(SCM el, SCM n, int destructive, const char *func_name) scm_misc_error(func_name, - "cannot set accent on character #~S: not enough characters: ~S", - scm_list_2(el, n)); + "cannot set accent on character #~S: not enough characters: ~A", + scm_list_2(n, el)); if (!elchr_isvowel(elstr->str[num])) scm_misc_error(func_name, - "cannot set accent on character #~S: not a vowel: ~S", - scm_list_2(el, n)); + "cannot set accent on character #~S: not a vowel: ~A", + scm_list_2(n, el)); @@ -720,4 +720,4 @@ SCM_DEFINE_PUBLIC(scm_elstr_char_prop_bitmask, "elstr-char-prop-bitmask", scm_misc_error(FUNC_NAME, - "cannot get character #~S: not enough characters: ~S", - scm_list_2(el, n)); + "cannot get character #~S: not enough characters: ~A", + scm_list_2(n, el)); return scm_from_uint(elchr_flags(elstr->str[num])); @@ -765,4 +765,4 @@ SCM_DEFINE_PUBLIC(scm_elstr_char_phoneme, "elstr-char-phoneme", scm_misc_error(FUNC_NAME, - "cannot get character #~S: not enough characters: ~S", - scm_list_2(el, n)); + "cannot get character #~S: not enough characters: ~A", + scm_list_2(n, el)); return scm_from_uint(elchr_phoneme(elstr->str[num])); diff --git a/src/ellinika/utf8scm.c b/src/ellinika/utf8scm.c index 89f5fba..1cb7f76 100644 --- a/src/ellinika/utf8scm.c +++ b/src/ellinika/utf8scm.c @@ -37,3 +37,3 @@ SCM_DEFINE_PUBLIC(scm_utf8_toupper, "utf8-toupper", 1, 0, 0, scm_misc_error(FUNC_NAME, - "cannot convert to upper case: ~S", + "cannot convert to upper case: ~A", scm_list_1(string)); @@ -57,3 +57,3 @@ SCM_DEFINE_PUBLIC(scm_utf8_tolower, "utf8-tolower", 1, 0, 0, scm_misc_error(FUNC_NAME, - "cannot convert to lower case: ~S", + "cannot convert to lower case: ~A", scm_list_1(string)); @@ -92,3 +92,3 @@ SCM_DEFINE_PUBLIC(scm_utf8_escape, "utf8-escape", 1, 1, 0, scm_misc_error(FUNC_NAME, - "cannot convert ~S to UTF-8", + "cannot convert ~A to UTF-8", scm_list_1(string)); @@ -108,3 +108,3 @@ SCM_DEFINE_PUBLIC(scm_utf8_escape, "utf8-escape", 1, 1, 0, scm_misc_error(FUNC_NAME, - "cannot convert ~S to UTF-8", + "cannot convert ~A to UTF-8", scm_list_1(escapable)); |