Skip to content

Commit bba024f

Browse files
committed
fix:exception framework
1 parent 9bd9b8c commit bba024f

3 files changed

Lines changed: 10 additions & 25 deletions

File tree

analysis/tokenizer.sls

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,7 @@
7676
[rest (string-take-right source (- (string-length source) position l))]
7777
[blank (make-string l #\space)])
7878
(private:tolerant-parse->patch (string-append head blank rest)))]
79-
[else
80-
(display-condition e)
81-
(newline)
82-
(pretty-print (condition-irritants e))
83-
(pretty-print (car (condition-irritants e)))
84-
(raise 'can-not-tolerant0)]))]
79+
[else (warning 'tokenizer-warning1 "" `(,(condition-who e) ,(condition-message e) ,(condition-irritants e)))]))]
8580
[(and (condition? e) (string? (caar (condition-irritants e))))
8681
(case (caar (condition-irritants e))
8782
[("unexpected dot (.)" "invalid sharp-sign prefix #~c" )
@@ -102,8 +97,8 @@
10297
[what (vector-ref (list->vector (string->list source)) position)]
10398
[rest (string-take-right source (- (string-length source) position 1))])
10499
(private:tolerant-parse->patch (string-append head ")" rest)))]
105-
[else (raise 'can-not-tolerant1)])]
106-
[else (raise 'can-not-tolerant2)]))))
100+
[else (warning 'tokenizer-warning2 "" `(,(condition-who e) ,(condition-message e) ,(condition-irritants e)))])]
101+
[else (warning 'tokenizer-warning2 "" `(,(condition-who e) ,(condition-message e) ,(condition-irritants e)))]))))
107102

108103
(define source-file->annotations
109104
(case-lambda
@@ -125,14 +120,9 @@
125120
(let ([after (private:tolerant-parse->patch source)])
126121
(if (= (string-length after) (string-length source))
127122
(source-file->annotations after path start-position #f)
128-
(raise 'can-not-tolerant)))]
129-
[(condition? e)
130-
(pretty-print `(format ,(condition-message e) ,@(condition-irritants e)))
131-
(pretty-print path)]
132-
[else
133-
(pretty-print e)
134-
(pretty-print path)
135-
'()]))))))))
123+
(error 'tokenizer-error (condition-message e) (condition-irritants e))))]
124+
[(condition? e) (error 'tokenizer-error0 path `(,source ,path ,position ,tolerant? ,(condition-who e) ,(condition-message e) ,(condition-irritants e)))]
125+
[else (warning 'tokenizer-error0 path `(,source ,path ,position ,tolerant? ,(condition-who e) ,(condition-message e) ,(condition-irritants e)))]))))))))
136126
;https://github.com/cisco/ChezScheme/blob/e63e5af1a5d6805c96fa8977e7bd54b3b516cff6/s/7.ss#L268-L280
137127
; consume
138128
; #!/usr/bin/env scheme-script

analysis/workspace.sls

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,11 @@
150150
(construct-substitutions-for document)
151151
(except c
152152
[(or (string? c) (symbol? c))
153-
(pretty-print target-path)
154-
(pretty-print 'workspace-error)
155-
(pretty-print c)]
153+
(warning 'init-warning0 target-path '(,c))]
154+
[(condition? c)
155+
(warning 'init-warning1 target-path `(,(condition-who c) ,(condition-message c) ,(condition-irritants c)))]
156156
[else
157-
(display-condition c)
158-
(pretty-print target-path)
159-
(pretty-print 'workspace-error)
160-
(pretty-print `(format ,(condition-message c) ,@(condition-irritants c)))
161-
'()])))
157+
(error 'init-error target-path '())])))
162158
(document-refreshable?-set! document #f)))
163159

164160
(define (update-file-node-with-tail workspace-instance target-file-node text)

scheme-langserver.sls

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
(define (private:try-catch server-instance request)
3333
(let ([method (request-method request)]
3434
[id (request-id request)])
35-
(pretty-print method)
3635
(try
3736
(process-request server-instance request)
3837
(except c

0 commit comments

Comments
 (0)