hexo-swpp 1.2.6 → 1.2.7

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.
Files changed (2) hide show
  1. package/index.js +9 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -141,6 +141,15 @@ const getJsonFromNetwork = async path => {
141
141
  'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.62'
142
142
  }
143
143
  })
144
+ switch (result.status) {
145
+ case 200: case 301: case 302: break
146
+ case 404:
147
+ logger.error(`拉取 ${url} 时出现 404,如果您是第一次构建请忽略这个错误`)
148
+ break
149
+ default:
150
+ // noinspection ExceptionCaughtLocallyJS
151
+ throw `拉取 ${url} 时出现 ${result.status},拉取到的内容:\n${result}`
152
+ }
144
153
  return await result.json()
145
154
  } catch (e) {
146
155
  // noinspection SpellCheckingInspection
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-swpp",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "hexo-log": "^3.0.0",