diff --git a/cli.go b/cli.go index 1f1b702..68f08ac 100644 --- a/cli.go +++ b/cli.go @@ -55,7 +55,7 @@ func (c CLI) Render(input io.Reader, output io.Writer, options *CLIOptions) erro if options != nil { args = append(args, options.Args()...) } - args = append(args, "--diagnostic-format", "short", "-", "-") + args = append(args, "--diagnostic-format", "human", "-", "-") // Get path of executable. execPath := ExecutablePath diff --git a/errors.go b/errors.go index 4025fde..f2ac856 100644 --- a/errors.go +++ b/errors.go @@ -19,10 +19,6 @@ type Error struct { } func (e *Error) Error() string { - if e.Message != "" { - return e.Message - } - return e.Raw } @@ -50,8 +46,8 @@ func (e *ErrorWithPath) Unwrap() error { return e.Inner } -var stderrRegex = regexp.MustCompile(`^error: (?.+)\n`) -var stderrWithPathRegex = regexp.MustCompile(`^(?.+):(?\d+):(?\d+): error: (?.+)\n$`) +var stderrRegex = regexp.MustCompile(`(?s)^error: (?.+?)\n`) +var stderrWithPathRegex = regexp.MustCompile(`(?s)^error: (?.+?)\n\s+┌─ (?.+?):(?\d+):(?\d+)\n`) // ParseStderr will parse the given stderr output and return a suitable error object. // Depending on the stderr message, this will return either a typst.Error or a typst.ErrorWithPath error.