-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update answer word endpoint (#311)
* feat: upload all answers as their own docs * feat: update answer endpoint * test: fix mock * feat: add error handling
- Loading branch information
1 parent
385d9a2
commit 5b63c8b
Showing
16 changed files
with
427 additions
and
176 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
library; | ||
|
||
export 'src/crossword_repository.dart'; | ||
export 'src/crossword_repository_exception.dart'; |
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
23 changes: 23 additions & 0 deletions
23
api/packages/crossword_repository/lib/src/crossword_repository_exception.dart
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,23 @@ | ||
import 'package:crossword_repository/crossword_repository.dart'; | ||
|
||
/// {@template crossword_repository_exception} | ||
/// Exception thrown when an error occurs in the [CrosswordRepository]. | ||
/// {@endtemplate} | ||
class CrosswordRepositoryException implements Exception { | ||
/// {@macro crossword_repository_exception} | ||
CrosswordRepositoryException(this.cause, this.stackTrace); | ||
|
||
/// Error cause. | ||
final dynamic cause; | ||
|
||
/// The stack trace of the error. | ||
final StackTrace stackTrace; | ||
|
||
@override | ||
String toString() { | ||
return ''' | ||
cause: $cause | ||
stackTrace: $stackTrace | ||
'''; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
api/packages/crossword_repository/test/src/crossword_repository_exception_test.dart
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,21 @@ | ||
import 'package:crossword_repository/crossword_repository.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
group('CrosswordRepositoryException', () { | ||
test('can be converted to a string', () { | ||
final exception = CrosswordRepositoryException( | ||
'something is broken', | ||
StackTrace.fromString('it happened here'), | ||
); | ||
|
||
expect( | ||
exception.toString(), | ||
equals(''' | ||
cause: something is broken | ||
stackTrace: it happened here | ||
'''), | ||
); | ||
}); | ||
}); | ||
} |
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
Oops, something went wrong.