Skip to content

Commit 62e5d87

Browse files
committed
fix(grade.ts): set record host and type when gradeWebsite returns 404
1 parent 099f104 commit 62e5d87

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/core/grade.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,18 @@ export async function website(url: string): Promise<Result> {
109109
try {
110110
record = await api.gradeWebsite(host)
111111
record.safe = await record.isSafe()
112+
store.set(cacheKey, record.toString())
112113
} catch (error) {
113114
record = new Result()
114115
record.score = 60
115116
record.safe = true
117+
// When there is no record on cloudopt.net yet
118+
if (error.error === 404) {
119+
record.host = 'UNKNOWN'
120+
record.type = 'UNKNOWN'
121+
store.set(cacheKey, record.toString())
122+
}
116123
}
117-
store.set(cacheKey, record.toString())
118124
}
119125

120126
return record

0 commit comments

Comments
 (0)