Skip to content

Commit

Permalink
Handle non existing npm package
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm1957 committed Oct 11, 2024
1 parent 45efcc8 commit 69a457d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Branch (`master/main/dev`) is optional.
-->

## Changelog
### **WORK IN PROGRESS**
* (mcm1957) Checker no longer crash id no npm package exists.

### 3.1.2 (2024-10-04)
* (mcm1957) Require node 18 minimum as engines clause.

Expand Down
9 changes: 7 additions & 2 deletions lib/M250_Npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@ axios.defaults.headers = {

async function checkNpm(context) {
console.log('\ncheckNpm [E250 - 299]');
const response = await axios(`https://registry.npmjs.org/iobroker.${context.adapterName}`)
let body = response.data;
let body;
try {
const response = await axios(`https://registry.npmjs.org/iobroker.${context.adapterName}`)
body = response.data;
} catch (e) {
/* */
}
// bug in NPM some modules could be accessed via normal web page, but not by API
if (!body) {
try {
Expand Down

0 comments on commit 69a457d

Please sign in to comment.