Skip to content

Commit 9db1f83

Browse files
author
ozelot379
committed
Merge branch 'develop' into 'master'
Improve error handling See merge request minecraft/ConvertJavaTextureToBedrock!23
2 parents 3da35f6 + 04465d6 commit 9db1f83

5 files changed

Lines changed: 36 additions & 23 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## [3.0.3]
4+
- Improve error handling
5+
36
## [3.0.2]
47
- Fix title
58

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@ozelot379/convert-minecraft-java-texture-to-bedrock",
33
"productName": "ConvertJavaTextureToBedrock",
4-
"version": "3.0.2",
4+
"version": "3.0.3",
55
"description": "Convert Minecraft Java texture packs to Bedrock texture packs",
66
"keywords": [
77
"Minecraft",

‎src/index.js‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ class ConvertJavaTextureToBedrock {
5050
* @returns {Promise<*>}
5151
*/
5252
async convert() {
53+
this.log.log("Start conversion");
54+
5355
if (this.options.experimental) {
5456
this.log.warn(`EXPERIMENTAL CONVERSIONS ENABLED!`)
5557
}
@@ -68,7 +70,11 @@ class ConvertJavaTextureToBedrock {
6870
await addAdditionalConverters(...await converter.convert());
6971
}
7072

71-
return await this.output.generate();
73+
const output = await this.output.generate();
74+
75+
this.log.log("Conversion finished");
76+
77+
return output;
7278
}
7379
}
7480

‎src/webapp/html/index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<div>Works directly in your browser - no upload</div>
3838
<div>More infos in the <a class="green-text"
3939
href="https://github.com/ozelot379/ConvertJavaTextureToBedrock/blob/master/README.md"
40-
target="_blank">readme</a></div>
40+
target="_blank">Readme</a></div>
4141
</div>
4242
<div class="col l6">
4343
<div>

‎src/webapp/js/index.js‎

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,23 @@ document.addEventListener("DOMContentLoaded", () => {
6565
});
6666
document.querySelector(".swal-button--loading").disabled = true;
6767

68-
_log("Start conversion");
69-
70-
if (worker !== null) {
71-
worker.terminate();
72-
worker = null;
73-
}
74-
worker = new Worker();
75-
worker.addEventListener("message", afterConvert);
76-
worker.addEventListener("error", errorConvert);
77-
worker.postMessage({
78-
files,
79-
options: {
80-
experimental: experimentalSwitch.checked
68+
try {
69+
if (worker !== null) {
70+
worker.terminate();
71+
worker = null;
8172
}
82-
});
73+
worker = new Worker();
74+
worker.addEventListener("message", afterConvert);
75+
worker.addEventListener("error", errorConvert);
76+
worker.postMessage({
77+
files,
78+
options: {
79+
experimental: experimentalSwitch.checked
80+
}
81+
});
82+
} catch (err) {
83+
errorConvert(err);
84+
}
8385
}
8486

8587
/**
@@ -129,7 +131,7 @@ document.addEventListener("DOMContentLoaded", () => {
129131
buttons: "Save"
130132
});
131133

132-
_log("Conversion finished");
134+
_log();
133135

134136
if (await savePopup) {
135137
if (output instanceof File) {
@@ -158,14 +160,16 @@ document.addEventListener("DOMContentLoaded", () => {
158160
}
159161

160162
/**
161-
* @param {string} log
163+
* @param {string|undefined} log
162164
*/
163-
function _log(log) {
164-
const li = document.createElement("li");
165+
function _log(log = undefined) {
166+
if (log) {
167+
const li = document.createElement("li");
165168

166-
li.innerText = log;
169+
li.innerText = log;
167170

168-
logs.appendChild(li);
171+
logs.appendChild(li);
172+
}
169173

170174
logs.scrollTop = logs.scrollHeight; // Scroll to bottom
171175
}

0 commit comments

Comments
 (0)