use console.error instead of console.log in cases of error

pull/139/head
Aevann 2023-03-12 11:54:14 +02:00
parent ab8ec6bfc5
commit cb37d3273f
5 changed files with 9 additions and 9 deletions

View File

@ -139,7 +139,7 @@ function buy(mb) {
xhr[0].onload = function() {
let data
try {data = JSON.parse(xhr[0].response)}
catch(e) {console.log(e)}
catch(e) {console.error(e)}
success = xhr[0].status >= 200 && xhr[0].status < 300;
showToast(success, getMessageFromJsonData(success, data), true);
if (success) {

View File

@ -9,7 +9,7 @@ function banModal(link, name, fullname, cls) {
xhr[0].onload = function() {
let data
try {data = JSON.parse(xhr[0].response)}
catch(e) {console.log(e)}
catch(e) {console.error(e)}
success = xhr[0].status >= 200 && xhr[0].status < 300;
showToast(success, getMessageFromJsonData(success, data));
document.getElementById(`unban-${fullname}`).classList.toggle(cls);
@ -31,7 +31,7 @@ function chudModal(link, name, fullname, cls) {
xhr[0].onload = function() {
let data
try {data = JSON.parse(xhr[0].response)}
catch(e) {console.log(e)}
catch(e) {console.error(e)}
success = xhr[0].status >= 200 && xhr[0].status < 300;
showToast(success, getMessageFromJsonData(success, data));
document.getElementById(`unchud-${fullname}`).classList.toggle(cls);

View File

@ -135,7 +135,7 @@ function post_reply(id){
let data
try {data = JSON.parse(xhr[0].response)}
catch(e) {console.log(e)}
catch(e) {console.error(e)}
if (data && data["comment"]) {
const comments = document.getElementById('replies-of-c_' + id);
const comment = data["comment"].replace(/data-src/g, 'src').replace(/data-cfsrc/g, 'src').replace(/style="display:none;visibility:hidden;"/g, '').replace(/data-nonce=".*?"/g, `data-nonce="${nonce}"`);
@ -191,7 +191,7 @@ function comment_edit(id){
let data
try {data = JSON.parse(xhr[0].response)}
catch(e) {console.log(e)}
catch(e) {console.error(e)}
if (data && data["comment"]) {
commentForm=document.getElementById('comment-text-'+id);
commentForm.innerHTML = data["comment"].replace(/data-src/g, 'src').replace(/data-cfsrc/g, 'src').replace(/style="display:none;visibility:hidden;"/g, '').replace(/data-nonce=".*?"/g, `data-nonce="${nonce}"`)
@ -248,7 +248,7 @@ function post_comment(fullname, hide){
let data
try {data = JSON.parse(xhr.response)}
catch(e) {console.log(e)}
catch(e) {console.error(e)}
if (data && data["comment"]) {
if (hide) document.getElementById(hide).classList.add('d-none');
@ -309,7 +309,7 @@ function handle_action(type, cid, thing) {
xhr.onload=function(){
let data
try {data = JSON.parse(xhr.response)}
catch(e) {console.log(e)}
catch(e) {console.error(e)}
if (data && data["response"]) {
const element = document.getElementById(`${type}-${cid}`);
element.innerHTML = data["response"].replace(/data-nonce=".*?"/g, `data-nonce="${nonce}"`)

View File

@ -38,7 +38,7 @@ function report_postModal(id) {
xhr.onload = function() {
let data
try {data = JSON.parse(xhr.response)}
catch(e) {console.log(e)}
catch(e) {console.error(e)}
success = xhr.status >= 200 && xhr.status < 300;
showToast(success, getMessageFromJsonData(success, data));
};

View File

@ -129,7 +129,7 @@ function checkRepost() {
xhr.onload=function(){
try {data = JSON.parse(xhr.response)}
catch(e) {console.log(e)}
catch(e) {console.error(e)}
if (data && data["permalink"]) {
const permalinkText = escapeHTML(data["permalink"]);