About: Descriptive errors
This commit is contained in:
parent
a0197e768b
commit
51f306d1c7
@ -295,9 +295,11 @@
|
|||||||
drawn.push({text: symbol, x: 0, y: 0, h: 39, rotate: true})
|
drawn.push({text: symbol, x: 0, y: 0, h: 39, rotate: true})
|
||||||
}else if(symbol === "↓"){
|
}else if(symbol === "↓"){
|
||||||
drawn.push({text: symbol, x: 0, y: 12, h: 45})
|
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)){
|
}else if(r.comma.test(symbol)){
|
||||||
// Comma, full stop
|
// 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)){
|
}else if(r.ideographicComma.test(symbol)){
|
||||||
// Ideographic comma, full stop
|
// Ideographic comma, full stop
|
||||||
drawn.push({text: symbol, x: 16, y: -16, h: 18})
|
drawn.push({text: symbol, x: 16, y: -16, h: 18})
|
||||||
@ -538,7 +540,7 @@
|
|||||||
let symbol = string[i]
|
let symbol = string[i]
|
||||||
|
|
||||||
if(symbol === "-"){
|
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 === "™"){
|
}else if(symbol === "™"){
|
||||||
drawn.push({text: symbol, x: -2, y: 0, w: 20, scale: [0.6, 0.5]})
|
drawn.push({text: symbol, x: -2, y: 0, w: 20, scale: [0.6, 0.5]})
|
||||||
}else if(symbol === " "){
|
}else if(symbol === " "){
|
||||||
@ -547,9 +549,11 @@
|
|||||||
drawn.push({text: ",", x: 0, y: -15, w: 7, scale: [1, 0.7]})
|
drawn.push({text: ",", x: 0, y: -15, w: 7, scale: [1, 0.7]})
|
||||||
}else if(symbol === "∀"){
|
}else if(symbol === "∀"){
|
||||||
drawn.push({text: symbol, x: -3, y: 0, w: 55})
|
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)){
|
}else if(r.comma.test(symbol)){
|
||||||
// Comma, full stop
|
// 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)){
|
}else if(r.en.test(symbol)){
|
||||||
// n-width
|
// n-width
|
||||||
drawn.push({text: symbol, x: 0, y: 0, w: 28})
|
drawn.push({text: symbol, x: 0, y: 0, w: 28})
|
||||||
@ -671,6 +675,9 @@
|
|||||||
ctx.save()
|
ctx.save()
|
||||||
ctx.translate(currentX, currentY)
|
ctx.translate(currentX, currentY)
|
||||||
if(symbol.scale){
|
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.scale(symbol.scale[0], symbol.scale[1])
|
||||||
ctx.lineWidth /= symbol.scale[0]
|
ctx.lineWidth /= symbol.scale[0]
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,8 @@ class Loader{
|
|||||||
getFilename(name){
|
getFilename(name){
|
||||||
return name.slice(0, name.lastIndexOf("."))
|
return name.slice(0, name.lastIndexOf("."))
|
||||||
}
|
}
|
||||||
errorMsg(){
|
errorMsg(error){
|
||||||
|
console.error(error)
|
||||||
this.error = true
|
this.error = true
|
||||||
this.loaderPercentage.appendChild(document.createElement("br"))
|
this.loaderPercentage.appendChild(document.createElement("br"))
|
||||||
this.loaderPercentage.appendChild(document.createTextNode("An error occurred, please refresh"))
|
this.loaderPercentage.appendChild(document.createTextNode("An error occurred, please refresh"))
|
||||||
|
@ -90,6 +90,10 @@ class loadSong{
|
|||||||
this.setupMultiplayer()
|
this.setupMultiplayer()
|
||||||
}, error => {
|
}, error => {
|
||||||
console.error(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")
|
alert("An error occurred, please refresh")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -194,13 +198,11 @@ class loadSong{
|
|||||||
if(event.value === song.difficulty){
|
if(event.value === song.difficulty){
|
||||||
this.startMultiplayer()
|
this.startMultiplayer()
|
||||||
}else{
|
}else{
|
||||||
this.selectedSong2 = {
|
this.selectedSong2 = {}
|
||||||
title: song.title,
|
for(var i in this.selectedSong){
|
||||||
folder: song.folder,
|
this.selectedSong2[i] = this.selectedSong[i]
|
||||||
difficulty: event.value,
|
|
||||||
type: song.type,
|
|
||||||
offset: song.offset
|
|
||||||
}
|
}
|
||||||
|
this.selectedSong2.difficulty = event.value
|
||||||
if(song.type === "tja"){
|
if(song.type === "tja"){
|
||||||
this.startMultiplayer()
|
this.startMultiplayer()
|
||||||
}else{
|
}else{
|
||||||
|
@ -5,11 +5,15 @@ addEventListener("error", function(err){
|
|||||||
}else{
|
}else{
|
||||||
stack = err.message + "\n at " + err.filename + ":" + err.lineno + ":" + err.colno
|
stack = err.message + "\n at " + err.filename + ":" + err.lineno + ":" + err.colno
|
||||||
}
|
}
|
||||||
|
errorMessage(stack)
|
||||||
|
})
|
||||||
|
|
||||||
|
function errorMessage(stack){
|
||||||
localStorage["lastError"] = JSON.stringify({
|
localStorage["lastError"] = JSON.stringify({
|
||||||
timestamp: +new Date,
|
timestamp: +new Date,
|
||||||
stack: stack
|
stack: stack
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
|
|
||||||
function toggleFullscreen(){
|
function toggleFullscreen(){
|
||||||
if("requestFullscreen" in root){
|
if("requestFullscreen" in root){
|
||||||
|
@ -68,10 +68,14 @@ class PageEvents{
|
|||||||
load(target){
|
load(target){
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.race(target, "load", "error", "abort").then(response => {
|
this.race(target, "load", "error", "abort").then(response => {
|
||||||
if(response.type === "load"){
|
switch(response.type){
|
||||||
return resolve(response.event)
|
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 => {
|
}).then(response => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
return this.context.decodeAudioData(response, resolve, reject)
|
return this.context.decodeAudioData(response, resolve, reject)
|
||||||
|
}).catch(error => {
|
||||||
|
throw [error, url]
|
||||||
})
|
})
|
||||||
}).then(buffer => {
|
}).then(buffer => {
|
||||||
return new Sound(gain || {soundBuffer: this}, buffer)
|
return new Sound(gain || {soundBuffer: this}, buffer)
|
||||||
|
Loading…
Reference in New Issue
Block a user