Skip to content

Commit 53faeda

Browse files
committed
Get a better error message if the library_index.json can't be parsed
See arduino#7937
1 parent 8fa6f11 commit 53faeda

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

arduino-core/src/cc/arduino/contributions/libraries/LibrariesIndexer.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@
3131

3232
import cc.arduino.Constants;
3333
import cc.arduino.contributions.packages.ContributedPlatform;
34+
35+
import com.fasterxml.jackson.core.JsonParseException;
3436
import com.fasterxml.jackson.databind.DeserializationFeature;
37+
import com.fasterxml.jackson.databind.JsonMappingException;
3538
import com.fasterxml.jackson.databind.ObjectMapper;
3639
import com.fasterxml.jackson.module.mrbean.MrBeanModule;
3740
import org.apache.commons.compress.utils.IOUtils;
@@ -101,8 +104,12 @@ private void parseIndex(File file) throws IOException {
101104
.forEach(library -> library.setCategory("Uncategorized"));
102105

103106
index = newIndex;
107+
} catch (JsonParseException | JsonMappingException e) {
108+
System.err.println(
109+
format(tr("Error parsing libraries index: {0}\nTry to open the Library Manager to update the libraries index."),
110+
e.getMessage()));
104111
} catch (Exception e) {
105-
System.err.println("Error parsing library.index:" + e.getMessage());
112+
System.err.println(format(tr("Error reading libraries index: {0}"), e.getMessage()));
106113
} finally {
107114
IOUtils.closeQuietly(indexIn);
108115
}

0 commit comments

Comments
 (0)