"api-test": "jest src/ -i --verbose"
},
"devDependencies": {
- "@types/jest": "^26.0.19",
+ "@types/jest": "^26.0.20",
+ "eslint": "^7.18.0",
+ "eslint-plugin-jane": "^9.0.3",
"jest": "^26.6.3",
"lemmy-js-client": "0.9.0-rc.12",
"node-fetch": "^2.6.1",
- "ts-jest": "^26.4.4",
"prettier": "^2.1.2",
- "eslint": "^7.10.0",
- "eslint-plugin-jane": "^9.0.3",
+ "ts-jest": "^26.4.4",
"typescript": "^4.1.3"
}
}
exec-sh "^0.3.2"
minimist "^1.2.0"
-"@eslint/eslintrc@^0.2.2":
- version "0.2.2"
- resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.2.2.tgz#d01fc791e2fc33e88a29d6f3dc7e93d0cd784b76"
- integrity sha512-EfB5OHNYp1F4px/LI/FEnGylop7nOqkQ1LRzCM0KccA2U8tvV8w01KBv37LbO7nW4H+YhKyo2LcJhRwjjV17QQ==
+"@eslint/eslintrc@^0.3.0":
+ version "0.3.0"
+ resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.3.0.tgz#d736d6963d7003b6514e6324bec9c602ac340318"
+ integrity sha512-1JTKgrOKAHVivSvOYw+sJOunkBjUOvjqWk1DPja7ZFhIS2mX/4EgTT8M7eTK9jrKhL/FvXXEbQwIs3pg1xp3dg==
dependencies:
ajv "^6.12.4"
debug "^4.1.1"
ignore "^4.0.6"
import-fresh "^3.2.1"
js-yaml "^3.13.1"
- lodash "^4.17.19"
+ lodash "^4.17.20"
minimatch "^3.0.4"
strip-json-comments "^3.1.1"
dependencies:
"@types/istanbul-lib-report" "*"
-"@types/jest@26.x", "@types/jest@^26.0.19":
+"@types/jest@26.x":
version "26.0.19"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.19.tgz#e6fa1e3def5842ec85045bd5210e9bb8289de790"
integrity sha512-jqHoirTG61fee6v6rwbnEuKhpSKih0tuhqeFbCmMmErhtu3BYlOZaXWjffgOstMM4S/3iQD31lI5bGLTrs97yQ==
jest-diff "^26.0.0"
pretty-format "^26.0.0"
+"@types/jest@^26.0.20":
+ version "26.0.20"
+ resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.20.tgz#cd2f2702ecf69e86b586e1f5223a60e454056307"
+ integrity sha512-9zi2Y+5USJRxd0FsahERhBwlcvFh6D2GLQnY2FH2BzK8J9s9omvNHIbvABwIluXa0fD8XVKMLTO0aOEuUfACAA==
+ dependencies:
+ jest-diff "^26.0.0"
+ pretty-format "^26.0.0"
+
"@types/json-schema@^7.0.3":
version "7.0.6"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.6.tgz#f4c7ec43e81b319a9815115031709f26987891f0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8"
integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==
-eslint@^7.10.0:
- version "7.17.0"
- resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.17.0.tgz#4ccda5bf12572ad3bf760e6f195886f50569adb0"
- integrity sha512-zJk08MiBgwuGoxes5sSQhOtibZ75pz0J35XTRlZOk9xMffhpA9BTbQZxoXZzOl5zMbleShbGwtw+1kGferfFwQ==
+eslint@^7.18.0:
+ version "7.18.0"
+ resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.18.0.tgz#7fdcd2f3715a41fe6295a16234bd69aed2c75e67"
+ integrity sha512-fbgTiE8BfUJZuBeq2Yi7J3RB3WGUQ9PNuNbmgi6jt9Iv8qrkxfy19Ds3OpL1Pm7zg3BtTVhvcUZbIRQ0wmSjAQ==
dependencies:
"@babel/code-frame" "^7.0.0"
- "@eslint/eslintrc" "^0.2.2"
+ "@eslint/eslintrc" "^0.3.0"
ajv "^6.10.0"
chalk "^4.0.0"
cross-spawn "^7.0.2"
js-yaml "^3.13.1"
json-stable-stringify-without-jsonify "^1.0.1"
levn "^0.4.1"
- lodash "^4.17.19"
+ lodash "^4.17.20"
minimatch "^3.0.4"
natural-compare "^1.4.0"
optionator "^0.9.1"
pub mod utils;
use crate::settings::Settings;
+use http::StatusCode;
use regex::Regex;
use thiserror::Error;
}
}
-impl actix_web::error::ResponseError for LemmyError {}
+impl actix_web::error::ResponseError for LemmyError {
+ fn status_code(&self) -> StatusCode {
+ match self.inner.downcast_ref::<diesel::result::Error>() {
+ Some(diesel::result::Error::NotFound) => StatusCode::NOT_FOUND,
+ _ => StatusCode::INTERNAL_SERVER_ERROR,
+ }
+ }
+}
lazy_static! {
pub static ref WEBFINGER_COMMUNITY_REGEX: Regex = Regex::new(&format!(