Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
Add selective sentry notification (#172)
Browse files Browse the repository at this point in the history
* Add selective sentry notification

* Refactor error properties tuple to struct

* Refactor errors and sentry notification
  • Loading branch information
feymartynov committed Oct 19, 2020
1 parent 8cc41bf commit 19302cd
Show file tree
Hide file tree
Showing 14 changed files with 306 additions and 271 deletions.
6 changes: 3 additions & 3 deletions src/app/endpoint/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ mod tests {
.await
.expect_err("Unexpected success on agents listing");

assert_eq!(err.status_code(), ResponseStatus::FORBIDDEN);
assert_eq!(err.status(), ResponseStatus::FORBIDDEN);
assert_eq!(err.kind(), "access_denied");
});
}
Expand Down Expand Up @@ -210,7 +210,7 @@ mod tests {
.await
.expect_err("Unexpected success on agents listing");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "room_closed");
});
}
Expand All @@ -231,7 +231,7 @@ mod tests {
.await
.expect_err("Unexpected success on agents listing");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "room_not_found");
});
}
Expand Down
10 changes: 5 additions & 5 deletions src/app/endpoint/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ mod test {
.await
.expect_err("Unexpected success on unicast message sending");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "room_not_found");
});
}
Expand Down Expand Up @@ -325,7 +325,7 @@ mod test {
.await
.expect_err("Unexpected success on unicast message sending");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "agent_not_entered_the_room");
});
}
Expand Down Expand Up @@ -366,7 +366,7 @@ mod test {
.await
.expect_err("Unexpected success on unicast message sending");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "agent_not_entered_the_room");
});
}
Expand Down Expand Up @@ -447,7 +447,7 @@ mod test {
.await
.expect_err("Unexpected success on unicast message sending");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "room_not_found");
});
}
Expand Down Expand Up @@ -478,7 +478,7 @@ mod test {
.await
.expect_err("Unexpected success on unicast message sending");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "agent_not_entered_the_room");
});
}
Expand Down
24 changes: 12 additions & 12 deletions src/app/endpoint/room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ mod test {
.await
.expect_err("Unexpected success on room creation");

assert_eq!(err.status_code(), ResponseStatus::FORBIDDEN);
assert_eq!(err.status(), ResponseStatus::FORBIDDEN);
assert_eq!(err.kind(), "access_denied");
});
}
Expand Down Expand Up @@ -612,7 +612,7 @@ mod test {
.await
.expect_err("Unexpected success on room reading");

assert_eq!(err.status_code(), ResponseStatus::FORBIDDEN);
assert_eq!(err.status(), ResponseStatus::FORBIDDEN);
assert_eq!(err.kind(), "access_denied");
});
}
Expand All @@ -628,7 +628,7 @@ mod test {
.await
.expect_err("Unexpected success on room reading");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "room_not_found");
});
}
Expand Down Expand Up @@ -840,7 +840,7 @@ mod test {
.await
.expect_err("Unexpected success on room update");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "room_not_found");
});
}
Expand Down Expand Up @@ -872,7 +872,7 @@ mod test {
.await
.expect_err("Unexpected success on room update");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "room_closed");
});
}
Expand Down Expand Up @@ -951,7 +951,7 @@ mod test {
.await
.expect_err("Unexpected success on room deletion");

assert_eq!(err.status_code(), ResponseStatus::FORBIDDEN);
assert_eq!(err.status(), ResponseStatus::FORBIDDEN);
assert_eq!(err.kind(), "access_denied");
});
}
Expand All @@ -967,7 +967,7 @@ mod test {
.await
.expect_err("Unexpected success on room deletion");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "room_not_found");
});
}
Expand Down Expand Up @@ -1052,7 +1052,7 @@ mod test {
.await
.expect_err("Unexpected success on room entering");

assert_eq!(err.status_code(), ResponseStatus::FORBIDDEN);
assert_eq!(err.status(), ResponseStatus::FORBIDDEN);
assert_eq!(err.kind(), "access_denied");
});
}
Expand All @@ -1068,7 +1068,7 @@ mod test {
.await
.expect_err("Unexpected success on room entering");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "room_not_found");
});
}
Expand Down Expand Up @@ -1107,7 +1107,7 @@ mod test {
.await
.expect_err("Unexpected success on room entering");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "room_closed");
});
}
Expand Down Expand Up @@ -1188,7 +1188,7 @@ mod test {
.await
.expect_err("Unexpected success on room leaving");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "agent_not_entered_the_room");
});
}
Expand All @@ -1204,7 +1204,7 @@ mod test {
.await
.expect_err("Unexpected success on room leaving");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "room_not_found");
});
}
Expand Down
22 changes: 11 additions & 11 deletions src/app/endpoint/rtc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ mod test {
.await
.expect_err("Unexpected success on rtc creation");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "room_not_found");
});
}
Expand All @@ -469,7 +469,7 @@ mod test {
.await
.expect_err("Unexpected success on rtc creation");

assert_eq!(err.status_code(), ResponseStatus::FORBIDDEN);
assert_eq!(err.status(), ResponseStatus::FORBIDDEN);
assert_eq!(err.kind(), "access_denied");
});
}
Expand Down Expand Up @@ -541,7 +541,7 @@ mod test {
.await
.expect_err("Unexpected success on rtc reading");

assert_eq!(err.status_code(), ResponseStatus::FORBIDDEN);
assert_eq!(err.status(), ResponseStatus::FORBIDDEN);
assert_eq!(err.kind(), "access_denied");
});
}
Expand All @@ -557,7 +557,7 @@ mod test {
.await
.expect_err("Unexpected success on rtc reading");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "room_not_found");
});
}
Expand Down Expand Up @@ -640,7 +640,7 @@ mod test {
.await
.expect_err("Unexpected success on rtc listing");

assert_eq!(err.status_code(), ResponseStatus::FORBIDDEN);
assert_eq!(err.status(), ResponseStatus::FORBIDDEN);
assert_eq!(err.kind(), "access_denied");
});
}
Expand All @@ -661,7 +661,7 @@ mod test {
.await
.expect_err("Unexpected success on rtc listing");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "room_not_found");
});
}
Expand Down Expand Up @@ -1110,7 +1110,7 @@ mod test {
.await
.expect_err("Connected to RTC while expected capacity exceeded error");

assert_eq!(err.status_code(), ResponseStatus::SERVICE_UNAVAILABLE);
assert_eq!(err.status(), ResponseStatus::SERVICE_UNAVAILABLE);
assert_eq!(err.kind(), "capacity_exceeded");

// Connect to the rtc in the room with free reserved slots.
Expand Down Expand Up @@ -1268,7 +1268,7 @@ mod test {
.await
.expect_err("Unexpected success on rtc connecting");

assert_eq!(err.status_code(), ResponseStatus::SERVICE_UNAVAILABLE);
assert_eq!(err.status(), ResponseStatus::SERVICE_UNAVAILABLE);
assert_eq!(err.kind(), "capacity_exceeded");
});
}
Expand Down Expand Up @@ -1649,7 +1649,7 @@ mod test {
.await
.expect_err("Connected to RTC while expected capacity exceeded error");

assert_eq!(err.status_code(), ResponseStatus::SERVICE_UNAVAILABLE);
assert_eq!(err.status(), ResponseStatus::SERVICE_UNAVAILABLE);
assert_eq!(err.kind(), "capacity_exceeded");
});
}
Expand Down Expand Up @@ -1680,7 +1680,7 @@ mod test {
.await
.expect_err("Unexpected success on rtc connecting");

assert_eq!(err.status_code(), ResponseStatus::FORBIDDEN);
assert_eq!(err.status(), ResponseStatus::FORBIDDEN);
assert_eq!(err.kind(), "access_denied");
});
}
Expand All @@ -1700,7 +1700,7 @@ mod test {
.await
.expect_err("Unexpected success on rtc connecting");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "room_not_found");
});
}
Expand Down
6 changes: 3 additions & 3 deletions src/app/endpoint/rtc_signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ mod test {
.await
.expect_err("Unexpected success on rtc creation");

assert_eq!(err.status_code(), ResponseStatus::FORBIDDEN);
assert_eq!(err.status(), ResponseStatus::FORBIDDEN);
assert_eq!(err.kind(), "access_denied");
});
}
Expand Down Expand Up @@ -540,7 +540,7 @@ mod test {
.await
.expect_err("Unexpected success on rtc creation");

assert_eq!(err.status_code(), ResponseStatus::BAD_REQUEST);
assert_eq!(err.status(), ResponseStatus::BAD_REQUEST);
assert_eq!(err.kind(), "invalid_sdp_type");
});
}
Expand Down Expand Up @@ -673,7 +673,7 @@ mod test {
.await
.expect_err("Unexpected success on rtc creation");

assert_eq!(err.status_code(), ResponseStatus::FORBIDDEN);
assert_eq!(err.status(), ResponseStatus::FORBIDDEN);
assert_eq!(err.kind(), "access_denied");
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/endpoint/rtc_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ mod test {
.await
.expect_err("Unexpected success on rtc listing");

assert_eq!(err.status_code(), ResponseStatus::FORBIDDEN);
assert_eq!(err.status(), ResponseStatus::FORBIDDEN);
assert_eq!(err.kind(), "access_denied");
});
}
Expand All @@ -258,7 +258,7 @@ mod test {
.await
.expect_err("Unexpected success on rtc listing");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "room_not_found");
});
}
Expand Down
8 changes: 4 additions & 4 deletions src/app/endpoint/subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ mod tests {
.await
.expect_err("Unexpected success on subscription creation");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "room_not_found");
});
}
Expand Down Expand Up @@ -341,7 +341,7 @@ mod tests {
.await
.expect_err("Unexpected success on subscription creation");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "room_closed");
});
}
Expand Down Expand Up @@ -515,7 +515,7 @@ mod tests {
.await
.expect_err("Unexpected success on subscription deletion");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "agent_not_entered_the_room");
});
}
Expand All @@ -540,7 +540,7 @@ mod tests {
.await
.expect_err("Unexpected success on subscription deletion");

assert_eq!(err.status_code(), ResponseStatus::NOT_FOUND);
assert_eq!(err.status(), ResponseStatus::NOT_FOUND);
assert_eq!(err.kind(), "agent_not_entered_the_room");
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/endpoint/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ mod test {
.await
.expect_err("Unexpected success on system vacuum");

assert_eq!(err.status_code(), ResponseStatus::FORBIDDEN);
assert_eq!(err.status(), ResponseStatus::FORBIDDEN);
assert_eq!(err.kind(), "access_denied");
})
}
Expand Down
Loading

0 comments on commit 19302cd

Please sign in to comment.