Skip to content

Commit c9b359a

Browse files
committed
feat: return nicer errors on invalid mod.json and missing loader version
1 parent f815007 commit c9b359a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/types/mod_json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl ModJson {
159159
Ok(j) => j,
160160
Err(e) => {
161161
log::error!("{}", e);
162-
return Err(ApiError::BadRequest("Invalid mod.json".to_string()));
162+
return Err(ApiError::BadRequest(format!("Invalid mod.json: {e}")));
163163
}
164164
};
165165
json.version = json.version.trim_start_matches('v').to_string();

src/types/models/loader_version.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ impl LoaderVersion {
170170
.await
171171
{
172172
Ok(Some(r)) => Ok(r.into_loader_version()),
173-
Ok(None) => Err(ApiError::NotFound("".to_string())),
173+
Ok(None) => Err(ApiError::NotFound(format!("Loader version \"{tag}\" not found"))),
174174
Err(e) => {
175175
log::error!("{:?}", e);
176176
Err(ApiError::DbError)

0 commit comments

Comments
 (0)