Skip to content

Commit 7b3f495

Browse files
authored
fix: handle panics in package analysis (#1134)
### PR Checklist - [x] The PR title follows [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) - [ ] Is this closing an open issue? If so, link it, else include a proper description of the changes and rason behind them. - [ ] Does the PR have changes to the frontend? If so, include screenshots or a recording of the changes. <br/>If it affect colors, please include screenshots/recording in both light and dark mode. - [ ] Does the PR have changes to the backend? If so, make sure tests are added. <br/>And if changing dababase queries, be sure you have ran `sqlx prepare` and committed the changes in the `.sqlx` directory.
1 parent 1acd7a9 commit 7b3f495

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

api/src/tarball.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ pub async fn process_tarball(
300300
)
301301
})
302302
.await
303-
.unwrap()?;
303+
.map_err(|e| PublishError::UnexpectedError(format!("{:?}", e)))??;
304304

305305
// ensure all of the JSR dependencies are resolvable
306306
for (kind, req) in dependencies.iter() {
@@ -612,6 +612,9 @@ pub enum PublishError {
612612
ScopedPackageNameValidateError,
613613
),
614614

615+
#[error("unexpected error: {0}")]
616+
UnexpectedError(String),
617+
615618
#[error("unresolvable 'jsr:' dependency: '{0}', no published version matches the constraint")]
616619
UnresolvableJsrDependency(PackageReq),
617620

@@ -632,6 +635,7 @@ impl PublishError {
632635
PublishError::GcsUploadError(_) => None,
633636
PublishError::MissingTarball => None,
634637
PublishError::DatabaseError(_) => None,
638+
PublishError::UnexpectedError(_) => None,
635639
PublishError::InvalidTarball(_) => Some("invalidTarball"),
636640
PublishError::LinkInTarball { .. } => Some("linkInTarball"),
637641
PublishError::InvalidEntryType { .. } => Some("invalidEntryType"),

0 commit comments

Comments
 (0)