-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
43 lines (32 loc) · 846 Bytes
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2012 Yuichi Araki. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package yall
import "strings"
type SyntaxError struct {
message string
}
func NewSyntaxError(message string) *SyntaxError {
return &SyntaxError{message}
}
func (serr *SyntaxError) String() string {
return serr.message
}
func (serr *SyntaxError) Error() string {
return serr.message
}
func isString(s string) bool {
return strings.HasPrefix(s, "\"") && strings.HasSuffix(s, "\"")
}
type RuntimeError struct {
message string
}
func NewRuntimeError(message string) *RuntimeError {
return &RuntimeError{message}
}
func (err *RuntimeError) String() string {
return "*** ERROR: " + err.message
}
func (err *RuntimeError) Error() string {
return "*** ERROR: " + err.message
}