mirror of
https://github.com/jiojciojsioe3/a3cjroijsiojiorj.git
synced 2024-11-14 23:11:51 +08:00
Merge pull request #88 from LoveEevee/about-descriptive-errors
About: Descriptive errors
This commit is contained in:
commit
7f5b1e97c3
@ -295,9 +295,11 @@
|
||||
drawn.push({text: symbol, x: 0, y: 0, h: 39, rotate: true})
|
||||
}else if(symbol === "↓"){
|
||||
drawn.push({text: symbol, x: 0, y: 12, h: 45})
|
||||
}else if(symbol === "."){
|
||||
drawn.push({realText: symbol, text: ".", x: 13, y: -7, h: 15, scale: [1.2, 0.7]})
|
||||
}else if(r.comma.test(symbol)){
|
||||
// Comma, full stop
|
||||
drawn.push({text: symbol, x: 13, y: -9, h: 13, scale: [1.2, 0.7]})
|
||||
drawn.push({text: symbol, x: 13, y: -7, h: 15, scale: [1.2, 0.7]})
|
||||
}else if(r.ideographicComma.test(symbol)){
|
||||
// Ideographic comma, full stop
|
||||
drawn.push({text: symbol, x: 16, y: -16, h: 18})
|
||||
@ -538,7 +540,7 @@
|
||||
let symbol = string[i]
|
||||
|
||||
if(symbol === "-"){
|
||||
drawn.push({text: symbol, x: -2, y: 0, w: 28, scale: [0.8, 1]})
|
||||
drawn.push({text: symbol, x: -2, y: 0, w: 28})
|
||||
}else if(symbol === "™"){
|
||||
drawn.push({text: symbol, x: -2, y: 0, w: 20, scale: [0.6, 0.5]})
|
||||
}else if(symbol === " "){
|
||||
@ -547,9 +549,11 @@
|
||||
drawn.push({text: ",", x: 0, y: -15, w: 7, scale: [1, 0.7]})
|
||||
}else if(symbol === "∀"){
|
||||
drawn.push({text: symbol, x: -3, y: 0, w: 55})
|
||||
}else if(symbol === "."){
|
||||
drawn.push({text: symbol, x: -9, y: 0, w: 37})
|
||||
}else if(r.comma.test(symbol)){
|
||||
// Comma, full stop
|
||||
drawn.push({text: symbol, x: 0, y: 0, w: 13})
|
||||
drawn.push({text: symbol, x: -3, y: 13, w: 13, scale: [1.2, 0.7]})
|
||||
}else if(r.en.test(symbol)){
|
||||
// n-width
|
||||
drawn.push({text: symbol, x: 0, y: 0, w: 28})
|
||||
@ -671,6 +675,9 @@
|
||||
ctx.save()
|
||||
ctx.translate(currentX, currentY)
|
||||
if(symbol.scale){
|
||||
if(config.baseline === "middle"){
|
||||
ctx.translate(0, -ctx.lineWidth * (2 / symbol.scale[1]))
|
||||
}
|
||||
ctx.scale(symbol.scale[0], symbol.scale[1])
|
||||
ctx.lineWidth /= symbol.scale[0]
|
||||
}
|
||||
|
@ -151,7 +151,8 @@ class Loader{
|
||||
getFilename(name){
|
||||
return name.slice(0, name.lastIndexOf("."))
|
||||
}
|
||||
errorMsg(){
|
||||
errorMsg(error){
|
||||
console.error(error)
|
||||
this.error = true
|
||||
this.loaderPercentage.appendChild(document.createElement("br"))
|
||||
this.loaderPercentage.appendChild(document.createTextNode("An error occurred, please refresh"))
|
||||
|
@ -90,6 +90,10 @@ class loadSong{
|
||||
this.setupMultiplayer()
|
||||
}, error => {
|
||||
console.error(error)
|
||||
if(Array.isArray(error) && error[1] instanceof HTMLElement){
|
||||
error = error[0] + ": " + error[1].outerHTML
|
||||
}
|
||||
errorMessage(new Error(error).stack)
|
||||
alert("An error occurred, please refresh")
|
||||
})
|
||||
}
|
||||
@ -194,13 +198,11 @@ class loadSong{
|
||||
if(event.value === song.difficulty){
|
||||
this.startMultiplayer()
|
||||
}else{
|
||||
this.selectedSong2 = {
|
||||
title: song.title,
|
||||
folder: song.folder,
|
||||
difficulty: event.value,
|
||||
type: song.type,
|
||||
offset: song.offset
|
||||
this.selectedSong2 = {}
|
||||
for(var i in this.selectedSong){
|
||||
this.selectedSong2[i] = this.selectedSong[i]
|
||||
}
|
||||
this.selectedSong2.difficulty = event.value
|
||||
if(song.type === "tja"){
|
||||
this.startMultiplayer()
|
||||
}else{
|
||||
|
@ -5,11 +5,15 @@ addEventListener("error", function(err){
|
||||
}else{
|
||||
stack = err.message + "\n at " + err.filename + ":" + err.lineno + ":" + err.colno
|
||||
}
|
||||
errorMessage(stack)
|
||||
})
|
||||
|
||||
function errorMessage(stack){
|
||||
localStorage["lastError"] = JSON.stringify({
|
||||
timestamp: +new Date,
|
||||
stack: stack
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function toggleFullscreen(){
|
||||
if("requestFullscreen" in root){
|
||||
|
@ -68,10 +68,14 @@ class PageEvents{
|
||||
load(target){
|
||||
return new Promise((resolve, reject) => {
|
||||
this.race(target, "load", "error", "abort").then(response => {
|
||||
if(response.type === "load"){
|
||||
return resolve(response.event)
|
||||
switch(response.type){
|
||||
case "load":
|
||||
return resolve(response.event)
|
||||
case "error":
|
||||
return reject(["Loading error", target])
|
||||
case "abort":
|
||||
return reject("Loading aborted")
|
||||
}
|
||||
return reject()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -10,6 +10,8 @@
|
||||
}).then(response => {
|
||||
return new Promise((resolve, reject) => {
|
||||
return this.context.decodeAudioData(response, resolve, reject)
|
||||
}).catch(error => {
|
||||
throw [error, url]
|
||||
})
|
||||
}).then(buffer => {
|
||||
return new Sound(gain || {soundBuffer: this}, buffer)
|
||||
|
Loading…
Reference in New Issue
Block a user