Skip to content

Commit

Permalink
chore: Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
spotandjake committed Sep 21, 2024
1 parent 4b9919b commit 8f11b91
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
5 changes: 1 addition & 4 deletions stdlib/exception.gr
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ from "runtime/exception" include Exception
*
* @since v0.3.0
*/
@disableGC
provide let rec registerPrinter = (printer: Exception => Option<String>) => {
Exception.registerPrinter(printer)
}
provide let registerPrinter = Exception.registerPrinter

/**
* Gets the string representation of the given exception.
Expand Down
12 changes: 7 additions & 5 deletions stdlib/runtime/exception.gr
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ let mut printers = []
*
* @param printer: The base exception printer to register
*
* @since v0.6.7
* @since v0.7.0
*/
provide let registerBasePrinter = printer => basePrinter = Some(printer)
provide let registerBasePrinter = (printer: Exception => String) =>
basePrinter = Some(printer)

/**
* Registers an exception printer. When an exception is thrown, all registered
Expand All @@ -25,9 +26,10 @@ provide let registerBasePrinter = printer => basePrinter = Some(printer)
*
* @param printer: The exception printer to register
*
* @since v0.6.7
* @since v0.7.0
*/
provide let registerPrinter = printer => printers = [printer, ...printers]
provide let registerPrinter = (printer: Exception => Option<String>) =>
printers = [printer, ...printers]

/**
* Gets the string representation of the given exception.
Expand Down Expand Up @@ -57,7 +59,7 @@ provide let toString = (e: Exception) => {
}

/**
* Throws an exception.
* Throws an uncatchable exception and traps.
*
* @param e: The exception to throw
*/
Expand Down
2 changes: 1 addition & 1 deletion stdlib/runtime/exception.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Returns:
panicWithException : (e: Exception) => a
```

Throws an exception.
Throws an uncatchable exception and traps.

Parameters:

Expand Down
2 changes: 1 addition & 1 deletion stdlib/runtime/gc.gr
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ primitive box = "@box"
primitive unbox = "@unbox"

let throwDecRefError = () => {
Panic.panic("DecRefError: Attempted to decrement a zero reference count")
Panic.panic("DecRefError: Reference count of zero")
}

let mut _DEBUG = false
Expand Down

0 comments on commit 8f11b91

Please sign in to comment.