fix indentation of some error messages

`raise-syntax-error' and `raise-arguments-error' do not
try to adjust indentation, anymore, because it's too confusing
This commit is contained in:
Matthew Flatt 2012-06-23 02:20:59 -07:00
parent 4323096a46
commit 91791983aa
4 changed files with 9 additions and 19 deletions

View File

@ -213,8 +213,8 @@ as a ``result'' instead of an ``argument.''}
Creates an @racket[exn:fail:contract] value and @racket[raise]s it as Creates an @racket[exn:fail:contract] value and @racket[raise]s it as
an exception. The @racket[name] is used as the source procedure's an exception. The @racket[name] is used as the source procedure's
name in the error message. The @racket[message] is the error name in the error message. The @racket[message] is the error
message; if @racket[message] contains newline characters, each new line is message; if @racket[message] contains newline characters, each extra line should be
suitably indented (by adding one extra space at the start). suitably indented (with one extra space at the start of each line), but it should not end with a newline character.
Each @racket[field] must have a corresponding @racket[v], Each @racket[field] must have a corresponding @racket[v],
and the two are rendered on their own and the two are rendered on their own
line in the error message, with each @racket[v] formatted line in the error message, with each @racket[v] formatted
@ -313,8 +313,8 @@ exception. Macros use this procedure to report syntax errors.
The @racket[name] argument is usually @racket[#f] when @racket[expr] The @racket[name] argument is usually @racket[#f] when @racket[expr]
is provided; it is described in more detail below. The is provided; it is described in more detail below. The
@racket[message] is used as the main body of the error message; if @racket[message] is used as the main body of the error message; if
@racket[message] contains newline characters, each new line is @racket[message] contains newline characters, each new line should be
suitably indented (by adding one extra space at the start). suitably indented (with one space at the start), and it should not end with a newline character.
The optional @racket[expr] argument is the erroneous source syntax The optional @racket[expr] argument is the erroneous source syntax
object or S-expression (but the expression @racket[#f] cannot be object or S-expression (but the expression @racket[#f] cannot be

View File

@ -1821,8 +1821,6 @@ void scheme_contract_error(const char *name, const char *msg, ...)
nlen = strlen(name); nlen = strlen(name);
seplen = strlen(sep); seplen = strlen(sep);
msg = indent_lines(msg, &mlen, 0, 1);
len += mlen + nlen + seplen + 10; len += mlen + nlen + seplen + 10;
s = scheme_malloc_atomic(len); s = scheme_malloc_atomic(len);
@ -2164,8 +2162,6 @@ static void do_wrong_syntax(const char *where,
where = scheme_symbol_val(who); where = scheme_symbol_val(who);
} }
s = (char *)indent_lines(s, &slen, 0, 1);
if (v) { if (v) {
if (dv) if (dv)
blen = scheme_sprintf(buffer, blen, blen = scheme_sprintf(buffer, blen,
@ -2742,11 +2738,6 @@ static Scheme_Object *do_raise_mismatch_error(const char *who, int mismatch, int
s = scheme_char_string_to_byte_string(argv[i+offset]); s = scheme_char_string_to_byte_string(argv[i+offset]);
st = SCHEME_BYTE_STR_VAL(s); st = SCHEME_BYTE_STR_VAL(s);
slen = SCHEME_BYTE_STRLEN_VAL(s); slen = SCHEME_BYTE_STRLEN_VAL(s);
if (i == 1) {
intptr_t fl = slen;
st = (char *)indent_lines(st, &fl, 0, 1);
slen = fl;
}
if (!mismatch) if (!mismatch)
total += 5; total += 5;
} else { } else {
@ -2781,7 +2772,6 @@ static Scheme_Object *do_raise_mismatch_error(const char *who, int mismatch, int
} else { } else {
s2 = SCHEME_BYTE_STR_VAL(s); s2 = SCHEME_BYTE_STR_VAL(s);
l2 = SCHEME_BYTE_STRLEN_VAL(s); l2 = SCHEME_BYTE_STRLEN_VAL(s);
s2 = (char *)indent_lines(s2, &l2, 0, 1);
} }
scheme_raise_exn(MZEXN_FAIL_CONTRACT, scheme_raise_exn(MZEXN_FAIL_CONTRACT,