Skip to content

Commit

Permalink
refactor: PR #28
Browse files Browse the repository at this point in the history
  • Loading branch information
ethicnology committed May 24, 2023
1 parent ef33ec6 commit 088faae
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
4 changes: 1 addition & 3 deletions lib/src/close.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ class Close {
/// Deserialize a nostr close message
/// - ["CLOSE", subscription_id]
Close.deserialize(input) {
if (input.length != 2) {
throw 'Invalid length for CLOSE message';
}
if (input.length != 2) throw 'Invalid length for CLOSE message';
subscriptionId = input[1];
}
}
4 changes: 1 addition & 3 deletions lib/src/event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ class Event {
bool verify = true,
}) {
pubkey = pubkey.toLowerCase();
if (verify && isValid() == false) {
throw 'Invalid event';
}
if (verify && isValid() == false) throw 'Invalid event';
}

/// Partial constructor, you have to fill the fields yourself
Expand Down
4 changes: 1 addition & 3 deletions lib/src/request.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ class Request {
/// Deserialize a nostr request message
/// - ["REQ", subscription_id, filter JSON, filter JSON, ...]
Request.deserialize(input) {
if (input.length < 3) {
throw 'Message too short';
}
if (input.length < 3) throw 'Message too short';
subscriptionId = input[1];
filters = [];
for (var i = 2; i < input.length; i++) {
Expand Down

0 comments on commit 088faae

Please sign in to comment.