sentry-cli 2.30.5__tar.gz → 2.31.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/Cargo.lock +1 -1
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/Cargo.toml +1 -1
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/PKG-INFO +1 -1
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/sentry_cli.egg-info/PKG-INFO +1 -1
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/sentry_cli.egg-info/SOURCES.txt +7 -1
- sentry_cli-2.31.1/src/api/connection_manager.rs +46 -0
- sentry_cli-2.31.1/src/api/encoding.rs +85 -0
- sentry_cli-2.31.1/src/api/errors/api_error.rs +89 -0
- sentry_cli-2.31.1/src/api/errors/mod.rs +12 -0
- sentry_cli-2.31.1/src/api/errors/sentry_error.rs +36 -0
- sentry_cli-2.30.5/src/api.rs → sentry_cli-2.31.1/src/api/mod.rs +201 -369
- sentry_cli-2.31.1/src/api/pagination.rs +46 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/debug_files/check.rs +8 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/files/upload.rs +16 -13
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/upload_proguard.rs +6 -3
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/config.rs +14 -2
- sentry_cli-2.31.1/src/main.rs +9 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/auth_token/org_auth_token.rs +1 -1
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/dif_upload.rs +5 -5
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/file_upload.rs +15 -13
- sentry_cli-2.30.5/src/main.rs +0 -14
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/LICENSE +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/MANIFEST.in +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/README.md +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/build.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/pyproject.toml +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/sentry_cli.egg-info/dependency_links.txt +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/sentry_cli.egg-info/top_level.txt +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/setup.cfg +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/setup.py +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/bashsupport.sh +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/bash_hook.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/debug_files/bundle_jvm.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/debug_files/bundle_sources.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/debug_files/find.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/debug_files/mod.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/debug_files/print_sources.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/debug_files/upload.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/deploys/list.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/deploys/mod.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/deploys/new.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/events/list.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/events/mod.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/files/delete.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/files/list.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/files/mod.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/info.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/issues/list.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/issues/mod.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/issues/mute.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/issues/resolve.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/issues/unresolve.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/login.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/mod.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/monitors/list.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/monitors/mod.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/monitors/run.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/organizations/list.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/organizations/mod.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/projects/list.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/projects/mod.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/react_native/appcenter.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/react_native/gradle.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/react_native/mod.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/react_native/xcode.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/releases/archive.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/releases/delete.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/releases/finalize.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/releases/info.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/releases/list.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/releases/mod.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/releases/new.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/releases/propose_version.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/releases/restore.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/releases/set_commits.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/repos/list.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/repos/mod.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/send_envelope.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/send_event.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/sourcemaps/explain.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/sourcemaps/inject.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/sourcemaps/mod.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/sourcemaps/resolve.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/sourcemaps/upload.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/uninstall.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/update.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/upload_dif.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/commands/upload_dsym.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/constants.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/android.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/appcenter.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/args.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/auth_token/auth_token_impl.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/auth_token/error.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/auth_token/mod.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/auth_token/test.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/auth_token/user_auth_token.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/chunks.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/cordova.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/dif.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/event.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/file_search.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/formatting.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/fs.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/http.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/logging.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/mod.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/progress.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/releases.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/retry.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/snapshots/sentry_cli__utils__vcs__generate_patch_default_twenty.snap +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/snapshots/sentry_cli__utils__vcs__generate_patch_ignore_missing.snap +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/snapshots/sentry_cli__utils__vcs__generate_patch_set_base.snap +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/snapshots/sentry_cli__utils__vcs__generate_patch_set_previous_commit.snap +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/snapshots/sentry_cli__utils__vcs__get_commits_from_git.snap +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/sourcemaps/inject.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/sourcemaps.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/system.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/ui.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/update.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/vcs.rs +0 -0
- {sentry_cli-2.30.5 → sentry_cli-2.31.1}/src/utils/xcode.rs +0 -0
|
@@ -11,11 +11,17 @@ sentry_cli.egg-info/PKG-INFO
|
|
|
11
11
|
sentry_cli.egg-info/SOURCES.txt
|
|
12
12
|
sentry_cli.egg-info/dependency_links.txt
|
|
13
13
|
sentry_cli.egg-info/top_level.txt
|
|
14
|
-
src/api.rs
|
|
15
14
|
src/bashsupport.sh
|
|
16
15
|
src/config.rs
|
|
17
16
|
src/constants.rs
|
|
18
17
|
src/main.rs
|
|
18
|
+
src/api/connection_manager.rs
|
|
19
|
+
src/api/encoding.rs
|
|
20
|
+
src/api/mod.rs
|
|
21
|
+
src/api/pagination.rs
|
|
22
|
+
src/api/errors/api_error.rs
|
|
23
|
+
src/api/errors/mod.rs
|
|
24
|
+
src/api/errors/sentry_error.rs
|
|
19
25
|
src/commands/bash_hook.rs
|
|
20
26
|
src/commands/info.rs
|
|
21
27
|
src/commands/login.rs
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
use std::convert::Infallible;
|
|
2
|
+
|
|
3
|
+
pub(super) struct CurlConnectionManager;
|
|
4
|
+
|
|
5
|
+
impl r2d2::ManageConnection for CurlConnectionManager {
|
|
6
|
+
type Connection = curl::easy::Easy;
|
|
7
|
+
type Error = Infallible;
|
|
8
|
+
|
|
9
|
+
fn connect(&self) -> Result<curl::easy::Easy, Infallible> {
|
|
10
|
+
Ok(curl::easy::Easy::new())
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
fn is_valid(&self, _conn: &mut curl::easy::Easy) -> Result<(), Infallible> {
|
|
14
|
+
Ok(())
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
fn has_broken(&self, _conn: &mut curl::easy::Easy) -> bool {
|
|
18
|
+
false
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
#[cfg(test)]
|
|
23
|
+
mod tests {
|
|
24
|
+
use super::*;
|
|
25
|
+
use r2d2::ManageConnection;
|
|
26
|
+
|
|
27
|
+
#[test]
|
|
28
|
+
fn test_connect() {
|
|
29
|
+
let manager = CurlConnectionManager;
|
|
30
|
+
|
|
31
|
+
// Just make sure the connection can be established without panic.
|
|
32
|
+
manager.connect().unwrap();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
#[test]
|
|
36
|
+
fn test_is_valid() {
|
|
37
|
+
let manager = CurlConnectionManager;
|
|
38
|
+
assert_eq!(manager.is_valid(&mut curl::easy::Easy::new()), Ok(()));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
#[test]
|
|
42
|
+
fn test_has_broken() {
|
|
43
|
+
let manager = CurlConnectionManager;
|
|
44
|
+
assert!(!manager.has_broken(&mut curl::easy::Easy::new()));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
use percent_encoding::{utf8_percent_encode, AsciiSet, CONTROLS};
|
|
2
|
+
use std::fmt::{Display, Formatter, Result};
|
|
3
|
+
|
|
4
|
+
// Based on https://docs.rs/percent-encoding/1.0.1/src/percent_encoding/lib.rs.html#104
|
|
5
|
+
// WHATWG Spec: https://url.spec.whatwg.org/#percent-encoded-bytes
|
|
6
|
+
// RFC3986 Reserved Characters: https://www.rfc-editor.org/rfc/rfc3986#section-2.2
|
|
7
|
+
const QUERY_ENCODE_SET: AsciiSet = CONTROLS
|
|
8
|
+
.add(b' ')
|
|
9
|
+
.add(b'"')
|
|
10
|
+
.add(b'#')
|
|
11
|
+
.add(b'<')
|
|
12
|
+
.add(b'>')
|
|
13
|
+
.add(b'+');
|
|
14
|
+
|
|
15
|
+
const PATH_SEGMENT_ENCODE_SET: AsciiSet = QUERY_ENCODE_SET
|
|
16
|
+
.add(b'`')
|
|
17
|
+
.add(b'?')
|
|
18
|
+
.add(b'{')
|
|
19
|
+
.add(b'}')
|
|
20
|
+
.add(b'%')
|
|
21
|
+
.add(b'/');
|
|
22
|
+
|
|
23
|
+
/// Wrapper that escapes arguments for URL path segments.
|
|
24
|
+
pub(super) struct PathArg<A: Display>(pub(super) A);
|
|
25
|
+
|
|
26
|
+
/// Wrapper that escapes arguments for URL query segments.
|
|
27
|
+
pub(super) struct QueryArg<A: Display>(pub(super) A);
|
|
28
|
+
|
|
29
|
+
impl<A: Display> Display for PathArg<A> {
|
|
30
|
+
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
|
|
31
|
+
// if we put values into the path we need to url encode them. However
|
|
32
|
+
// special care needs to be taken for any slash character or path
|
|
33
|
+
// segments that would end up as ".." or "." for security reasons.
|
|
34
|
+
// Since we cannot handle slashes there we just replace them with the
|
|
35
|
+
// unicode replacement character as a quick workaround. This will
|
|
36
|
+
// typically result in 404s from the server.
|
|
37
|
+
let mut val = format!("{}", self.0).replace('/', "\u{fffd}");
|
|
38
|
+
if val == ".." || val == "." {
|
|
39
|
+
val = "\u{fffd}".into();
|
|
40
|
+
}
|
|
41
|
+
utf8_percent_encode(&val, &PATH_SEGMENT_ENCODE_SET).fmt(f)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
impl<A: Display> Display for QueryArg<A> {
|
|
46
|
+
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
|
|
47
|
+
utf8_percent_encode(&format!("{}", self.0), &QUERY_ENCODE_SET).fmt(f)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
#[cfg(test)]
|
|
52
|
+
mod tests {
|
|
53
|
+
use rstest::rstest;
|
|
54
|
+
|
|
55
|
+
use super::*;
|
|
56
|
+
|
|
57
|
+
#[rstest]
|
|
58
|
+
#[case("/")]
|
|
59
|
+
#[case(".")]
|
|
60
|
+
#[case("..")]
|
|
61
|
+
fn test_path_arg_replacement_cases(#[case] input: &str) {
|
|
62
|
+
assert_eq!(
|
|
63
|
+
format!("{}", PathArg(input)),
|
|
64
|
+
format!("{}", utf8_percent_encode("\u{fffd}", CONTROLS)),
|
|
65
|
+
"case \"{input}\" failed"
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
#[rstest]
|
|
70
|
+
#[case(" ", "%20")]
|
|
71
|
+
#[case("\"", "%22")]
|
|
72
|
+
#[case("#", "%23")]
|
|
73
|
+
#[case("<", "%3C")]
|
|
74
|
+
#[case(">", "%3E")]
|
|
75
|
+
#[case("+", "%2B")]
|
|
76
|
+
#[case(" \"#<>+", "%20%22%23%3C%3E%2B")]
|
|
77
|
+
#[case("1 + 3 < 4", "1%20%2B%203%20%3C%204")]
|
|
78
|
+
fn test_path_arg_percent_encode(#[case] input: &str, #[case] expected: &str) {
|
|
79
|
+
assert_eq!(
|
|
80
|
+
format!("{}", PathArg(input)),
|
|
81
|
+
expected,
|
|
82
|
+
"case \"{input}\" failed"
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
use std::fmt;
|
|
2
|
+
|
|
3
|
+
#[derive(Debug, thiserror::Error)]
|
|
4
|
+
pub struct ApiError {
|
|
5
|
+
inner: ApiErrorKind,
|
|
6
|
+
#[source]
|
|
7
|
+
source: Option<anyhow::Error>,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/// Represents API errors.
|
|
11
|
+
#[derive(Copy, Clone, Eq, PartialEq, Debug, thiserror::Error)]
|
|
12
|
+
pub(in crate::api) enum ApiErrorKind {
|
|
13
|
+
#[error("could not serialize value as JSON")]
|
|
14
|
+
CannotSerializeAsJson,
|
|
15
|
+
#[error("could not parse JSON response")]
|
|
16
|
+
BadJson,
|
|
17
|
+
#[error("not a JSON response")]
|
|
18
|
+
NotJson,
|
|
19
|
+
#[error("request failed because API URL was incorrectly formatted")]
|
|
20
|
+
BadApiUrl,
|
|
21
|
+
#[error("organization not found")]
|
|
22
|
+
OrganizationNotFound,
|
|
23
|
+
#[error("resource not found")]
|
|
24
|
+
ResourceNotFound,
|
|
25
|
+
#[error("Project not found. Please check that you entered the project and organization slugs correctly.")]
|
|
26
|
+
ProjectNotFound,
|
|
27
|
+
#[error("release not found")]
|
|
28
|
+
ReleaseNotFound,
|
|
29
|
+
#[error("chunk upload endpoint not supported by sentry server")]
|
|
30
|
+
ChunkUploadNotSupported,
|
|
31
|
+
#[error("API request failed")]
|
|
32
|
+
RequestFailed,
|
|
33
|
+
#[error("could not compress data")]
|
|
34
|
+
CompressionFailed,
|
|
35
|
+
#[error("region overrides cannot be applied to absolute urls")]
|
|
36
|
+
InvalidRegionRequest,
|
|
37
|
+
#[error(
|
|
38
|
+
"Auth token is required for this request. Please run `sentry-cli login` and try again!"
|
|
39
|
+
)]
|
|
40
|
+
AuthMissing,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
impl fmt::Display for ApiError {
|
|
44
|
+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
45
|
+
fmt::Display::fmt(&self.inner, f)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
impl ApiError {
|
|
50
|
+
pub(in crate::api) fn with_source<E>(kind: ApiErrorKind, source: E) -> ApiError
|
|
51
|
+
where
|
|
52
|
+
E: Into<anyhow::Error>,
|
|
53
|
+
{
|
|
54
|
+
ApiError {
|
|
55
|
+
inner: kind,
|
|
56
|
+
source: Some(source.into()),
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
pub(in crate::api) fn kind(&self) -> ApiErrorKind {
|
|
61
|
+
self.inner
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
fn set_source<E: Into<anyhow::Error>>(mut self, source: E) -> ApiError {
|
|
65
|
+
self.source = Some(source.into());
|
|
66
|
+
self
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
impl From<ApiErrorKind> for ApiError {
|
|
71
|
+
fn from(kind: ApiErrorKind) -> ApiError {
|
|
72
|
+
ApiError {
|
|
73
|
+
inner: kind,
|
|
74
|
+
source: None,
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
impl From<curl::Error> for ApiError {
|
|
80
|
+
fn from(err: curl::Error) -> ApiError {
|
|
81
|
+
ApiError::from(ApiErrorKind::RequestFailed).set_source(err)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
impl From<curl::FormError> for ApiError {
|
|
86
|
+
fn from(err: curl::FormError) -> ApiError {
|
|
87
|
+
ApiError::from(ApiErrorKind::RequestFailed).set_source(err)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
mod api_error;
|
|
2
|
+
mod sentry_error;
|
|
3
|
+
|
|
4
|
+
pub(super) use api_error::{ApiError, ApiErrorKind};
|
|
5
|
+
pub(super) use sentry_error::SentryError;
|
|
6
|
+
|
|
7
|
+
#[derive(Clone, Debug, thiserror::Error)]
|
|
8
|
+
#[error("project was renamed to '{0}'\nPlease use this slug in your .sentryclirc file, sentry.properties file or in the CLI --project parameter")]
|
|
9
|
+
pub(super) struct ProjectRenamedError(pub(super) String);
|
|
10
|
+
|
|
11
|
+
/// Shortcut alias for results of this module.
|
|
12
|
+
pub(super) type ApiResult<T> = Result<T, ApiError>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
use std::fmt;
|
|
2
|
+
|
|
3
|
+
#[derive(Debug, thiserror::Error)]
|
|
4
|
+
pub(in crate::api) struct SentryError {
|
|
5
|
+
pub(in crate::api) status: u32,
|
|
6
|
+
pub(in crate::api) detail: Option<String>,
|
|
7
|
+
pub(in crate::api) extra: Option<serde_json::Value>,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
impl fmt::Display for SentryError {
|
|
11
|
+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
12
|
+
let detail = self.detail.as_deref().unwrap_or("");
|
|
13
|
+
write!(
|
|
14
|
+
f,
|
|
15
|
+
"sentry reported an error: {} (http status: {})",
|
|
16
|
+
if detail.is_empty() {
|
|
17
|
+
match self.status {
|
|
18
|
+
400 => "bad request",
|
|
19
|
+
401 => "unauthorized",
|
|
20
|
+
404 => "not found",
|
|
21
|
+
500 => "internal server error",
|
|
22
|
+
502 => "bad gateway",
|
|
23
|
+
504 => "gateway timeout",
|
|
24
|
+
_ => "unknown error",
|
|
25
|
+
}
|
|
26
|
+
} else {
|
|
27
|
+
detail
|
|
28
|
+
},
|
|
29
|
+
self.status
|
|
30
|
+
)?;
|
|
31
|
+
if let Some(ref extra) = self.extra {
|
|
32
|
+
write!(f, "\n {extra:?}")?;
|
|
33
|
+
}
|
|
34
|
+
Ok(())
|
|
35
|
+
}
|
|
36
|
+
}
|