-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Modernise error handling in `str_interp()` * Make errors more consistent
- Loading branch information
Showing
7 changed files
with
67 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# str_interp fails when encountering nested placeholders | ||
|
||
Code | ||
str_interp("${${msg}}") | ||
Condition | ||
Error in `str_interp()`: | ||
! Invalid template string for interpolation. | ||
Code | ||
str_interp("$[.2f]{${msg}}") | ||
Condition | ||
Error in `str_interp()`: | ||
! Invalid template string for interpolation. | ||
|
||
# str_interp fails when input is not a character string | ||
|
||
Code | ||
str_interp(3L) | ||
Condition | ||
Error in `str_interp()`: | ||
! `string` must be a character vector, not the number 3. | ||
|
||
# str_interp wraps parsing errors | ||
|
||
Code | ||
str_interp("This is a ${1 +}") | ||
Condition | ||
Error in `str_interp()`: | ||
! Failed to parse input "1 +" | ||
Caused by error in `parse()`: | ||
! <text>:2:0: unexpected end of input | ||
1: 1 + | ||
^ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters