Browse Source

- v1.0.1

- Errors are better handled
- Specific errors are shown for problems with the transformation
- Fixed: The update system does not update the next version correctly
tags/v1.4.4
Ivan Bravo Bravo 1 year ago
parent
commit
934784fb68

+ 12
- 0
src/assets/css/base/_reset.scss View File

@@ -21,3 +21,15 @@ body,
html {
@apply overflow-hidden;
}

.swal-content {
font-size: 16px;

p {
@apply mb-3;
}

a {
@apply text-primary underline;
}
}

+ 0
- 1
src/components/Layout/Navigation.vue View File

@@ -80,7 +80,6 @@ export default {
methods: {
testBug() {
$tools.testError()
$rollbar.error(new Error('wow much error'))
throw new Error('wow much error')
}
}

+ 1
- 1
src/components/UI/AppPhoto.vue View File

@@ -32,7 +32,7 @@ export default {

&:hover {
@apply absolute rounded z-50;
transform: scale(2);
transform: scale(2.5);
}
}


+ 16
- 14
src/electron/modules/error.js View File

@@ -3,23 +3,25 @@ class AppError extends Error {
*
* @param {*} message
*/
constructor(message, error) {
if ($rollbar.isEnabled) {
const response = $rollbar.error(error || new Error(message))
constructor(message, error, level = 'error') {
if (level !== 'debug') {
if ($rollbar.isEnabled) {
const response = $rollbar[level](error || new Error(message))

if (response.uuid) {
if (response.uuid) {
message += `
\nFor more information please report the following URL on Github or to the developers:\n
https://rollbar.com/occurrence/uuid/?uuid=${response.uuid}`
} else {
message += `
\nFor more information please take a screenshot and report the following on Github or to the developers:\n
${error}`
}
} else if (error) {
message += `
\nFor help, please report the following to one of our developers:\n
https://rollbar.com/occurrence/uuid/?uuid=${response.uuid}`
} else {
message += `
\nFor help, take a screenshot and report the following to one of our developers:\n
${error}`
\nFor more information please take a screenshot and report the following on Github or to the developers:\n
${error}`
}
} else if (error) {
message += `
\nFor help, take a screenshot and report the following to one of our developers:\n
${error}`
}

super(message)

+ 1
- 0
src/electron/modules/rollbar.js View File

@@ -22,6 +22,7 @@ const instance = {
captureIp: 'anonymize',
verbose: process.env.NODE_ENV === 'development',
nodeSourceMaps: true,
reportLevel: 'warning',
payload: {
environment:
process.env.NODE_ENV !== 'development' ? 'production' : 'development',

+ 2
- 2
src/electron/tools/index.js View File

@@ -22,7 +22,7 @@ module.exports = {
*
*/
testError() {
$rollbar.error(Error('tools error!'))
Error('tools error!')
},

/**
@@ -164,7 +164,7 @@ module.exports = {
})

process.on('close', code => {
debug(`CLI process exited with code ${code}`)
console.log(`CLI process exited with code ${code}`)
bus.emit('ready', null, code)
})


+ 1
- 0
src/modules/index.js View File

@@ -1,5 +1,6 @@
export { default as File } from './file'
export { default as Timer } from './timer'
export { default as WebError } from './web-error'

export { default as nudify } from './nudify'
export { default as platform } from './platform'

+ 77
- 12
src/modules/models/photo-job.js View File

@@ -2,6 +2,7 @@ import _ from 'lodash'
import moment from 'moment'
import File from '../file'
import Timer from '../timer'
import WebError from '~/modules/web-error'

const debug = require('debug').default('app:modules:models:photo-job')

@@ -114,6 +115,70 @@ export default class PhotoJob {
return this.file
}

/**
*
*/
getCliError() {
if (_.isNil(this.cli.error) || this.cli.error.length === 0) {
return { type: 'debug', message: '' }
}

const message = this.cli.error

if (message.includes('Found no NVIDIA driver on your system')) {
return {
type: 'debug',
message:
"Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from [here](http://www.nvidia.com/Download/index.aspx). If you don't have an NVIDIA GPU please change the Device option in Settings to **CPU**."
}
}

if (message.includes('The NVIDIA driver on your system is too old')) {
return {
type: 'debug',
message:
'The NVIDIA driver installed on your system is too old! Please update the drivers [here](http://www.nvidia.com/Download/index.aspx), if the drivers are up to date then your GPU may not be compatible.'
}
}

if (message.includes('no longer supports this GPU')) {
return {
type: 'debug',
message:
'We are sorry but your GPU is not powerful enough to run this program. Please change the Device option in Settings to **CPU**.'
}
}

if (message.includes('Buy new RAM!')) {
return {
type: 'debug',
message:
'Apparently you have run out of RAM on your system! Try a photo of smaller size or free all possible memory of your system.'
}
}

if (message.includes('CUDA out of memory')) {
return {
type: 'debug',
message:
'Apparently you have run out of RAM on your GPU! Try a photo of smaller size.'
}
}

if (message.includes("codec can't decode byte")) {
return {
type: 'debug',
message:
'The algorithm had a problem decoding some characters. This is usually caused by being installed in a location with special characters (accents, spaces, etc.). Please reinstall the program in another location.'
}
}

return {
type: 'error',
message: `The process has been interrupted by an unknown error, this may be caused by a corrupt installation, please check the console for more information.`
}
}

/**
*
*/
@@ -132,10 +197,11 @@ export default class PhotoJob {
return new Promise((resolve, reject) => {
const onSpawnError = error => {
reject(
new AppError(
`Unable to start the CLI!\n
This can be caused by a corrupt installation, please make sure that the cli executable exists and works correctly. If you are not a developer please make sure you have the option "Use Python" disabled.`,
error
new WebError(
`Unable to start DreamPower!\n
Could not find the executable to DreamPower, in Settings please make sure that the option "DreamPower Folder" is valid, if you are not a developer make sure that the option "Use Python" is disabled.`,
error,
'warning'
)
)
}
@@ -189,15 +255,14 @@ export default class PhotoJob {
} else {
this.process = undefined

const err = this.getCliError()

reject(
new AppError(
`The process has been interrupted by an error. This can be caused by:\n
- A corrupt installation
- Insufficient RAM. Buy more RAM! (8 GB recommended)
- If you are using GPU: The graphics card was not found, it is not compatible (minimum: 3.5 CUDA compute capability) or the drivers are outdated.
- Check the console for more information.
`,
new Error(this.cli.error)
new WebError(
`Transformation #${this.id} failed`,
err.message,
Error(this.cli.error),
err.type
)
)
}

+ 6
- 1
src/modules/models/photo.js View File

@@ -6,6 +6,7 @@ import MemoryStore from 'better-queue-memory'
import File from '../file'
import Timer from '../timer'
import PhotoJob from './photo-job'
import WebError from '../web-error'

const debug = require('debug').default('app:modules:models:photo')

@@ -96,7 +97,11 @@ export default class Photo {
job.onFail()

if (_.isError(error)) {
swal(`Transformation #${jobId} failed`, error.message, 'error')
if (error instanceof WebError) {
error.report()
} else {
throw error
}
}
})


+ 2
- 2
src/modules/update/base.js View File

@@ -95,8 +95,8 @@ export default class {

const extension = $tools.utils.platform({
macos: '',
windows: '.7z',
linux: '.deb'
windows: '.exe',
linux: '.AppImage'
})

return `${this.getTitle()}-v${

+ 97
- 0
src/modules/web-error.js View File

@@ -0,0 +1,97 @@
/*
* DreamTime | (C) 2019 by Ivan Bravo Bravo <ivan@dreamnet.tech>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License 3.0 as published by
* the Free Software Foundation.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import _ from 'lodash'
import { markdown } from 'markdown'
import swal from 'sweetalert'

class WebError extends Error {
constructor(title, message, error, level = 'error') {
super(message)

this.title = title
this.error = error
this.level = level
}

report() {
let { message } = this
const { error, level } = this

console.log('Reporting error...', {
message,
error,
level,
weberror: this
})

if ($rollbar.isEnabled) {
const response = $rollbar[level](error || Error(this.message))

if (response.uuid) {
message += `
\nFor more information please report the following URL on Github or to the developers:
[https://rollbar.com/occurrence/uuid/?uuid=${response.uuid}](https://rollbar.com/occurrence/uuid/?uuid=${response.uuid})`
} else {
message += `
\nFor more information please take a screenshot and report the following on Github or to the developers:\n
${error}`
}
} else if (error) {
message += `
\nFor more information please take a screenshot and report the following on Github or to the developers:\n
${error}`
}

let icon = 'error'

if (level === 'warning') {
icon = 'warning'
}

if (level === 'info') {
icon = 'info'
}

const text = document.createElement('div')
text.innerHTML = markdown.toHTML(message)

swal({
title: this.title,
content: text,
icon
})

const links = document.querySelectorAll('.swal-content a')

for (const link of links) {
link.addEventListener('click', e => {
e.preventDefault()
$tools.shell.openItem(e.target.href)
})
}
}

static handle(error) {
if (!(error instanceof WebError)) {
error = new WebError(
'An error has occurred!',
'Oops! An unknown error has awakened us from our dreams, we will try to solve it in the next version.',
_.isError(error) ? error : new Error(error)
)
}

error.report()
return true
}
}

export default WebError

+ 11
- 9
src/package.json View File

@@ -1,8 +1,8 @@
{
"name": "dreamtime",
"version": "1.0.0",
"version": "1.0.1",
"main": "electron/index.js",
"author": "Iván Bravo Bravo <ivan@dreamnet.tech>",
"author": "DreamNet <dreamtime@dreamnet.tech>",
"homepage": "https://time.dreamnet.tech",
"license": "GPL-3.0-only",
"private": true,
@@ -14,7 +14,7 @@
"url": "https://github.com/private-dreamnet/dreamtime/issues"
},
"build": {
"appId": "com.kolessios.dreamtime",
"appId": "com.dreamnet.dreamtime",
"productName": "DreamTime",
"directories": {
"output": "../dist"
@@ -76,10 +76,15 @@
"license": "license.txt"
},
"linux": {
"target": "deb",
"icon": "static/favicon.ico",
"target": "AppImage",
"icon": "static/assets/images/dreamtime.png",
"executableName": "DreamTime",
"category": "Graphics"
},
"appimage": {
"license": "license.txt",
"category": "Graphics",
"artifactName": "${productName}.${ext}"
}
},
"scripts": {
@@ -98,10 +103,8 @@
"dependencies": {
"@nuxtjs/dotenv": "^1.4.0",
"@nuxtjs/pwa": "^2.6.0",
"aws-sdk": "^2.503.0",
"better-queue": "^3.8.10",
"better-queue-memory": "^1.0.3",
"bullet-train-nodejs": "^0.1.2",
"clipboard": "^2.0.4",
"compare-versions": "^3.5.0",
"cropperjs": "^1.5.2",
@@ -116,18 +119,17 @@
"image-js": "^0.21.7",
"js-event-bus": "^1.0.0",
"lodash": "^4.17.11",
"markdown": "^0.5.0",
"md5": "^2.2.1",
"mime-types": "^2.1.24",
"moment": "^2.24.0",
"nuxt": "^2.0.0",
"patch-package": "^6.1.2",
"postinstall-postinstall": "^2.0.0",
"queue": "^6.0.1",
"randomcolor": "^0.5.4",
"randomstring": "^1.1.5",
"raw-loader": "^3.0.0",
"regedit": "^3.0.3",
"rookout": "^0.1.67",
"supports-color": "^7.0.0",
"sweetalert": "^2.1.2",
"tippy.js": "^4.3.4",

+ 39
- 10
src/plugins/boot.client.js View File

@@ -1,8 +1,9 @@
import Vue from 'vue'
import moment from 'moment'
import tippy from 'tippy.js'
import swal from 'sweetalert'
import BaseMixin from '~/mixins/BaseMixin'
import { dream, platform, updater, nudify } from '~/modules'
import { dream, platform, updater, nudify, WebError } from '~/modules'

const debug = require('debug').default('app:plugins:boot')

@@ -27,6 +28,16 @@ tippy.setDefaults({
arrowType: 'round'
})

function live(selector, event, callback, context) {
;(context || document).addEventListener(event, function event(e) {
let found
let el = e.target || e.srcElement
// eslint-disable-next-line
while (el && !(found = el.id == selector)) el = el.parentElement
if (found) callback.call(el, e)
})
}

export default async ({ app, isDev }, inject) => {
// Environment Information
debug('Enviroment', {
@@ -54,6 +65,33 @@ export default async ({ app, isDev }, inject) => {

//---

window.addEventListener('error', (error, url, lineNumber) => {
console.log('Error captured', {
error,
type: typeof error
})

WebError.handle(error)
return true
})

window.addEventListener('unhandledrejection', rejection => {
console.log('Unhandled Rejection captured', {
error: rejection.reason,
type: typeof rejection.reason
})

WebError.handle(rejection.reason)
return true
})

Vue.config.errorHandler = (err, vm, info) => {
WebError.handle(err)
throw err
}

//---

// Platform information
await platform.init()
app.context.$platform = platform
@@ -77,15 +115,6 @@ export default async ({ app, isDev }, inject) => {
app.context.$nudify = nudify
inject('nudify', nudify)

Vue.config.errorHandler = (err, vm, info) => {
// Report Vue.js Errors
if ($rollbar.isEnabled) {
$rollbar.error(err)
}

throw err
}

// axios - default headers
// $axios.setHeader('X-Requested-With', 'XMLHttpRequest')


Loading…
Cancel
Save