You've already forked AstralRinth
244c263e40
* Analytics events * prepare * change route prefix * update route return * Add mod launcher analytics * more UA strings * fix ci * caching on analytics events * Return parent modpack versions for playtime queries * sqlx prepare * fmt * dummy fixtures
1.7 KiB
1.7 KiB
- Use
ApiErroras the error type for API routes - The return type of an HTTP route should not be
HttpResponseif possible; always prefer more specific types- Use
web::Json<T>for JSON-encoded response - Use
()for no content
- Use
- Prefer
ApiErrorvariants:ApiError::Requestinstead ofApiError::InvalidInputApiError::Authinstead ofApiError::CustomAuthenticationApiError::Internalfor database errors, 3rd party service errors, anything else internal- Use
eyre!to construct a value forInternalandRequestvariants
- Error messages (both for errors and exceptions) must be formatted as per the Rust API guidelines:
- lowercase message
- no trailing punctuation
- wrap code items e.g. type names in backticks
- Prefer
wrap_internal_err,wrap_request_errwhen attaching context to an existing error (like Anyhowcontextor Eyrewrap_err) - All operations should ideally have some context attached
- Database operations can have a message like
.wrap_internal_err("failed to fetch XYZ")
- Database operations can have a message like
- You can perform real-time queries against the databases in the Docker Compose
docker exec labrinth-postgres psql -c "select 1"docker exec labrinth-redis redis-cli flushalldocker exec labrinth-clickhouse clickhouse-client "select 1"- On some machines, you may have to use
podmaninstead ofdocker- check which one is available first
- Hardcoded credentials for admin:
Authorization: Bearer mra_adminfor default admin userAuthorization: Bearer mra_userfor a regular userModrinth-Admin: feedbeefas admin key
- If some steps require you to create a project/mod or version for testing, ask the user to go into the web frontend and manually create a project/version