Regex – DD-MON-YY – JS

I’ve been having this issue over the last few years and i’ve finally had enough of it

For some reason, the below regex conistantly advises that certain months (i.e. March/May) do not have a valid date for the 31’st day (naturally however both March and May have 31 days). However i’ve gone over this regex time and time again, yet can’t make heads or tails as to why its doing it

 function isdateField1(currVal) {

 if (currVal == '') return false;

//Declare Regex  
var rxDatePattern = /^(d{1,2})(-)(?:|(jan)|(feb)|(mar)|(apr)|(may)|(jun)|(jul)|(aug)|(sep)|(oct)|(nov)|(dec))(-)(d{2})$/i;

var dtArray = currVal.match(rxDatePattern);

if (dtArray == null) return false;

var dtDay = parseInt(dtArray[1]);
var dtMonth = parseInt(dtArray[3]);
var dtYear = parseInt(dtArray[17]);

if (isNaN(dtMonth)) {
    for (var i = 4; i <= 15; i++) {
        if ((dtArray[i])) {
            dtMonth = i - 3;
            break;
        }
    }
}
if (dtMonth < 1 || dtMonth > 12) return false;
else if (dtDay < 1 || dtDay > 31) return false;
else if ((dtMonth == 4 || dtMonth == 6 || dtMonth == 9 || dtMonth == 11) && dtDay == 31) return false;
else if (dtMonth == 2) {
    var isleap = (dtYear % 4 == 0 && (dtYear % 100 != 0 || dtYear % 400 == 0));
    if (dtDay > 29 || (dtDay == 29 && !isleap)) return false;
}
   return true;
}

I think I just need a 2nd set of eyes to go over it, I don’t doubt its something small overlooked.

Thanks

How can I troubleshoot a 500 error when attempting to load a GIF image after deploying using cyclic?

In my html file:

<img class="imagesit " src="images/sit_AdobeExpress.gif" width="320px" height="200px">

I have an image in my html file. After I use cyclic to link my github and deploy the repository which contains html file and javascript file, the website work normally except the GIF image doesn’t show up.

It appears the error status code: Failed to load resource: the server responded with a status of 500 ().

In my js file:

const express = require("express");

const bodyPaser = require("body-parser");

const https = require("https");

const app = express();

app.use(express.static("public"));

The images folder is in the public folder. All the images work normally except the GIF image doesn’t show up.

Anyone can help me to solve this problem?

How to make a syntax highlighter that highlights operators?

How to make a syntax highlighter that highlights operators ?

I want to highlight the operators of python by using pure Java script

<title>Syntax Highlighting Example</title>

<style>

    * {

        background: #000;

        color: white;

        font-size: 30px;

    }

    /* CSS styles for syntax highlighting */

    .keyword {

        color: blue;

        font-weight: bold;

    }

    .string {

        color: green;

    }

    .comment {

        color: gray;

        font-style: italic;

    }

</style>
<pre>

    <code id="code">

        // Example JavaScript code

        function greet(name) {

            if (name === "Alice") {

                console.log("Hello, " + name + "!");

            } else {

                console.log("Greetings, " + name + "!");

                console.log('Greetings, ' + name + '!');

            }

        }

        greet("Bob");

    </code>

</pre>

<script>

    // Syntax highlighting function

    function highlightSyntax() {

        // Get the code element

        var codeElement = document.getElementById('code');

        // Get the code text

        var codeText = codeElement.textContent;

        // Regular expression patterns for syntax elements

        var patterns = [

            { regex: /"(?:\.|[^\"])*"/g, className: 'string' }, // Double quotes

            { regex: /'(?:\.|[^\'])*'/g, className: 'string' }, // Single quotes

            { regex: ///(.*)/g, className: 'comment' }

        ];

        // Keywords to be highlighted

        var keywords = ['function', 'if', 'else', 'for', 'while', 'do', 'switch', 'case', 'break', 'continue'];

        // Operators to be highlighted

        var operators = ['+', '-', '*', '/', '=', '==', '!=', '>', '<', '>=', '<='];

        // Iterate over each pattern and apply syntax highlighting

        patterns.forEach(function (pattern) {

            codeText = codeText.replace(pattern.regex, function (match) {

                return '<span class="' + pattern.className + '">' + match + '</span>';

            });

        });

        // Apply keyword highlighting

        keywords.forEach(function (keyword) {

            var regex = new RegExp('\b' + keyword + '\b', 'g');

            codeText = codeText.replace(regex, '<span class="keyword">' + keyword + '</span>');

        });

        var regexes = [];

        operators.forEach(function (operator) {

            var regex = new RegExp('\b' + escapeRegExp(operator) + '\b', 'g');

            regexes.push(regex);

        });

        function escapeRegExp(string) {

            return string.replace(/[.*+?^${}()|[]\]/g, '\$&');

        }

        // Testing the regular expressions

        var code = [

            'x = y + 5',

            'if (x > y) {',

            'result = x == y',

            'if (a <= b && b != c) {',

            'z = x * y / 2',

            'if (x === y) {'

        ];

        var matches = [];

        code.forEach(function (line) {

            regexes.forEach(function (regex) {

                var result = line.match(regex);

                if (result) {

                    matches = matches.concat(result);

                }

            });

        });

        console.log('Matches:', matches);

        // var codeExamples = [

        //     'x = y + 5',

        //     'if (x > y) {',

        //     'result = x == y',

        //     'if (a <= b && b != c) {',

        //     'z = x * y / 2',

        //     'if (x === y) {'

        // ];

        // var regex = /[-+*/=<>!]=?|===|!==|>=|<=/;

        // codeExamples.forEach(function (code) {

        //     var matches = code.match(regex);

        //     console.log('Code:', code);

        //     console.log('Matches:', matches);

        //     console.log('---');

        // });

        // Set the updated code HTML

        codeElement.innerHTML = codeText;

    }

    // Call the syntax highlighting function

    highlightSyntax();

</script>

How to make a syntax highlighter that highlights operators ?

I am expecting that operators are also get highlighted. Like keywords and string are highlighted in above image without using any framework or Library

How to set all content in a to a blank target (target=”_blank”)

I need to set all of the content in a certain <div> to open to another tab ( target="_blank").
I don’t really care how this is solved, you can use JS, CSS, HTML, classes, IDs, et cetera.

I tried using <base target="_blank"> but it covered everything no matter what rather than just a certain area.
Example:
<a href="example.html"> <div> <base target="_blank"> [CONTENT] </div>
I thought that example.html would be opened in the same tab, but its target is set to "_blank" as well.

I also tried doing <div target="_blank"> but it didn’t make any effect, instead it was treated as a normal <div>.

Sending drip SMS via Twilio in a flow

this is my first post and I’m a non developer trying hard to learn how to use Twilio.

I’m got my head around the basics of Twilio Studio including limited API but can’t figure out how to achieve the following if I could get some help, please.

Not sure whether it matters but this is just a POC; I recently had surgery and they sent me an email survey after a month asking me how I felt weeks ago which I thought was pretty pointless. Now, as a method of learning I’m trying to figure out if and how this could work via SMS for better customer experience.

Patient is sent an SMS at intervals (night of surgery, then 7, 14 and 21 days after) asking them to rate their pain by replying with a number from 1 through 10.

My attempt…

So far I’ve managed to build out the first message, where the patient surgery date along with first name and mobile number is stored in Google Sheets. A webhook is sent to Twilio Studio to send a message at 6pm the night of surgery, courtesy of Pabbly.

I’m aware of Twilio having no native delay function, but have stumbled on the below code, but unsure if this could be extended to 1 week and if even possible, whether there’s a better way to achieve this?

exports.handler = function(context, event, callback) {
    setTimeout(function() {
        callback();
    }, 2000);
};

I don’t really want to wait to find out and believe I read somewhere about limits on this delay function. I have got this exact code to work for a quick pause on replies to reduce the automated feel of ridiculously quick response (learnt from a Twilio use case example).

The solution really needs to follow a flow so it doesn’t risk that pain rates are linked to the wrong time period. It also needs to be sent from the same number so multiple API calls won’t work (as far as I know) and neither would key words given patient responses are not unique.

Thanks, Brendan

Variable locator using playwright

I would like to use locator in playwright, but i need to use the locator to click on a button that should change in my “for”. I need to click in a button, collect data, click in another button, colect the same data…
My code:
for (let i = 0;i < data.listTeamOne.length; i++) {
let a = “xpath=/html/body/div[1]/div/div[3]/div[2]/div/div/div/div[1]/div/div/div/div[1]/div[2]/div[2]/div[“i+1″]/div[2]/div[2]/div[2]/div/div”
await page.locator(a).click()
but that syntax does not work
Someone have any ideia to help?

for (let i = 0;i < data.listTeamOne.length; i++) {
let a = “xpath=/html/body/div[1]/div/div[3]/div[2]/div/div/div/div[1]/div/div/div/div[1]/div[2]/div[2]/div[“i+1″]/div[2]/div[2]/div[2]/div/div”

How to dynamically set two attributes in a class in PhP?

I am experiencing an issue where the order-id and product-quantity attributes of the checkboxes do not change dynamically within the loop. I would appreciate guidance on how to code it in a manner that ensures their dynamic alteration within the loop.

I would like some assistance with this problem.

(the code snippet provided cannot be run)

function updateNonManquant(order_id, totalProducts)
{
    for (let i = 0; i < totalProducts; i++)
    {
        var checkbox = document.getElementById(i);
        var product_id = checkbox.name;
        var button = checkbox.getAttribute("data-order-id");
        var product_quantity = checkbox.getAttribute("data-product-quantity");
        alert(order_id);
        alert(button);
        if (button.includes(order_id))
        {
            var date = new Date().toISOString().slice(0, 19).replace('T', ' ');
            var xhr = makeRequest();
            var sql;

            if (checkbox.checked)
            {
                sql = `UPDATE article SET etat_stock = 1 WHERE id = ${product_id} AND num_commande = ${order_id}`;
                xhr.send(JSON.stringify({sql: sql}));

                xhr = makeRequest();

                sql = `UPDATE produit SET stock = stock - ${product_quantity} WHERE id = ${product_id}`;
                xhr.send(JSON.stringify({sql: sql}));
            } 
            else
            {     
                sql = `UPDATE article SET etat_stock = 0 WHERE id = ${product_id} AND num_commande = ${order_id}`;
                xhr.send(JSON.stringify({sql: sql}));
            }

            xhr = makeRequest();

            sql = `UPDATE commande SET etat_commande = 2, date_traitement = '${date}' WHERE num_commande = ${order_id}`;
            xhr.send(JSON.stringify({sql: sql}));
        }
    }
    window.location.reload();
}

function makeRequest()
{
    var xhr = new XMLHttpRequest();
    var url = "db_query.php";

    xhr.onreadystatechange = function()
    {
      if (this.readyState == 4 && this.status == 200)
      {
        var results = JSON.parse(this.responseText);
      }
    };
    
    xhr.open("POST", url, true);
    xhr.setRequestHeader("Content-Type", "application/json");

    return xhr;
}
<?php
    require_once "process_orders.php";
?>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Commande Client</title>
        <link rel="stylesheet" href="style.css">
        <script src="updateNonManquant_function.js"></script>
    </head>

    <body>
        <?php
        if ($number_of_orders == 0)
        {
            ?>

            <div class="centerPage">
                <h1>Aucun panier à traiter</h1>
            </div>

            <?php
        }
        else
        {
            ?>
            <h1 class="centerMargin">Traitement des paniers</h1>
            <?php

            $checkbox_id = 0;
            for ($i = 0; $i < $number_of_orders; $i++) 
            {
                ?>
                <table>
                    <tr>
                        <th colspan="3"><?php echo $customerOrder[$i]->getName(); ?></th>
                    </tr>
                    <tr>
                        <th>Produit</th>
                        <th>Quantité</th>
                        <th><?php echo $customerOrder[$i]->getOrder_date(); ?></th>
                    </tr>
                    <?php

                    for ($j = 0; $j < $customerOrder[$i]->getTotalProducts(); $j++)
                    {
                        $product_name = $customerOrder[$i]->getProductName($j);
                        $product_quantity = $customerOrder[$i]->getProductQuantity($j);
                        $product_id = $customerOrder[$i]->getProductId($j);
                        $order_id = $customerOrder[$i]->getOrder_id();
                        ?>
                        <tr>
                            <td><?php echo $product_name; ?></td>
                            <td><?php echo $product_quantity; ?></td>
                            <td><input type="checkbox" name="<?php echo $product_id ;?>" 
                                    class="checkbox" 
                                    data-order-id="<?php echo $order_id; ?>" 
                                    data-product-quantity="<?php echo $product_quantity; ?>"
                                    id="<?php echo $checkbox_id ?>" <?php if($customerOrder[$i]->getProductAvailable($j) == "true") { echo "checked"; } ?>></td>
                        </tr>
                        <?php
                        $checkbox_id++;
                    }
                    ?>
                    </table>
                    <table style="border-color: transparent;">
                    <tr>
                        <th colspan="3" style="background-color : transparent;">
                            <button id="<?php echo $customerOrder[$i]->getOrder_id(); ?>" onclick="updateNonManquant(<?php echo $customerOrder[$i]->getOrder_id(); ?>, <?php echo $customerOrder[$i]->getTotalProducts();?>)">Valider</button>
                        </th>
                    </tr>
                </table>
                
                <br> <br>
                <?php
            }
        }
        ?>
    </body>
</html>

SyntaxError: Unexpected token ‘export’ when using an NPM package I created in TypeScript

I’ve created my own npm package in TypeScript. I import the package from another project like this:

import {computeSum} from '@charneykaye/compute-sum';

But this results in an error:

 Details:

    /home/runner/work/consume-sum/consume-sum/packages/example/node_modules/@charneykaye/compute-sum/index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){export * from './feature';
                                                                                      ^^^^^^

    SyntaxError: Unexpected token 'export'

    > 1 | import {computeSum} from '@charneykaye/compute-sum';
        | ^
      2 |
      3 | export const computeTripleSum = (a: number, b: number, c: number) => {
      4 |   return computeSum(computeSum(a, b),c)

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1495:14)
      at Object.require (src/implementation.ts:1:1)
      at Object.<anonymous> (src/__tests__/feature-test.ts:2:1)

Here’s all the code from my example repository that publishes the package:

package.json

{
  "name": "@charneykaye/compute-sum",
  "version": "1.0.4",
  "repository": {
    "type": "git",
    "url": "git+ssh://[email protected]/charneykaye/compute-sum.git"
  },
  "description": "Typescript package for testing",
  "author": "Charney Kaye <[email protected]>",
  "license": "MIT",
  "files": [
    "*.js",
    "*.ts"
  ],
  "pika": true,
  "sideEffects": false,
  "scripts": {
    "start": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/index.ts",
    "start:windows": "nodemon --watch 'src/**/*.ts' --exec \"npx ts-node\" src/index.ts",
    "build": "npx tsc",
    "create": "npm run build && npm run test",
    "catalog": "npx ts-node src/index.ts",
    "test": "tsc -p . && jest --coverage --verbose --runInBand"
  },
  "dependencies": {
    "commander": "^10.0.0",
    "dotenv": "^16.0.3",
    "figlet": "^1.5.2",
    "octokit": "^1.8.0",
    "stemmer": "^1.0.5",
    "ts-node": "^10.9.1",
    "typescript": "^4.9.5"
  },
  "devDependencies": {
    "@jest/globals": "^29.4.1",
    "@types/jest": "^29.4.0",
    "@types/node": "^18.15.3",
    "jest": "^29.4.1",
    "nodemon": "^2.0.20",
    "ts-jest": "^29.0.5"
  },
  "publishConfig": {
    "access": "restricted"
  },
  "bugs": {
    "url": "https://github.com/charneykaye/compute-sum/issues"
  },
  "homepage": "https://github.com/charneykaye/compute-sum#readme",
  "main": "dist/index.js",
  "types": "dist/index.d.ts"
}

tsconfig.json

{
  "compilerOptions": {
    "declaration": true,
    "esModuleInterop": true,
    "moduleResolution": "Node",
    "outDir": "dist",
    "resolveJsonModule": true,
    "rootDir": "src",
    "strict": true,
    "target": "es6",
    "types": [
      "node",
      "jest"
    ]
  }
}

src/index.ts

export * from './feature'

src/feature.ts

export const computeSum =(a: number, b: number): number => a + b

Output package structure

@charneykaye
└── compute-sum
    ├── feature.d.ts
    ├── feature.js
    ├── index.d.ts
    ├── index.js
    ├── package.json
    └── README.md

Full Examples

The example project @charneykaye/consume-sum imports the example package @charneykaye/compute-sum

How to fix ‘addEventListener’ not working in Violentmonkey or Tampermonkey Chrome extension?

I want a button to be automatically clicked after 0.1 seconds after entering 5 characters in a textbox….

This code works correctly in the console(developer.F12) section of the browser. But I want this code to be executed permanently in the browser by Violentmonkey or Tampermonkey extension.

var textbox = document.getElementById("Text");

var button = document.getElementsByClassName("btn")[0];

textbox.addEventListener("input", function() {
  var inputText = textbox.value.trim();
  if (inputText.length === 5) {
    setTimeout(function() {
      button.click();
    }, 100);
  }
});

But This is not working in Violentmonkey or Tampermonkey Chrome extension….

Please see this picture:

https://i.stack.imgur.com/WjTx3.png

How can I run this code in the Violentmonkey or Tampermonkey Chrome extension?

Needing input field to toggle

I’m finishing up an online movie library and I have an “Add to List” button that uses AJAX to keep the page from refreshing when clicked. It works great but it doesn’t toggle, which ultimately I need it to do. I need to be able to add and then remove without a page refresh. Right now the if/else targets two seperate functions. I’m terrible with JavaScript and have tried hacking it together using various example from StackOverflow, but I haven’t been successful. I’m not strong enough with Javascript to figure this out, or to modify other people’s code to get it to work. Any help getting this to toggle would be greatly appreciated.

enter image description here

Main code

<div id="content-new">
    <?php   
    $sql_action = "SELECT movies.img, movies.title, movies.title_full, movies.new, my_list.title, my_list.username FROM movies LEFT JOIN my_list ON movies.title_full = my_list.title WHERE new != '' ORDER BY movies.id DESC LIMIT 16";
    $result_action = mysqli_query( $db_connect, $sql_action )or die( mysqli_error( $db_connect ) );
    while ( $row_action = mysqli_fetch_assoc( $result_action ) ) {
      $img = $row_action[ 'img' ];
      $title = $row_action[ 'title' ];
      $title_full = $row_action[ 'title_full' ];
      $new = $row_action [ 'new' ];
      $mylist = $row_action[ 'username' ];
        
      // CHECK IF FAV EXISTS MORE THAN ONCE IN DB
      $stmt_count_fav = $db_connect->prepare("SELECT title FROM my_list WHERE title = ?"); 
      $stmt_count_fav->bind_param("s", $title_full);
      $stmt_count_fav -> execute();
      $stmt_count_fav -> store_result();
      $stmt_count_fav -> fetch();
      $count_fav = $stmt_count_fav->num_rows;
      $stmt_count_fav->close();
      ?>
    
<div id="div_fav_hover">
<form id="form-new" style="padding: 20px 0px 20px 0px;" method="post" action="movie.php">
    <input id="btn_top" style="display: none" type="text" name="latest" id="latest" value="<?php if ($title_full == '') {echo $title;} else {echo $title_full;} ?>" />
    <?php if ($mylist == $username) { ?>      
    <input id="new_releases" type="image" name="image" src="images/<?php echo $img ?>">
    <?php } else if ($count_fav <= 1) { ?>
    <input id="new_releases" type="image" name="image" src="images/<?php echo $img ?>">
    <?php } ?>
</form>

<?php if ( $mylist == $username) { // ON MY LIST ?> 
<div class="div_new_delete">
  <form id="form-new" class="class_new_delete">
    <input style="display: none" type="text" name="title_home" value="<?php echo $title_full; ?>" />
    <input style="display: none" name="favorite_delete_home" value="favorite_delete_home" />
    <input id="btn_mylist_on_home" type="submit" name="btn_password" value="" class="class_fav_hover_on">
  </form>
</div>
<?php } else if ($count_fav <= 1) { // ON NO ONE'S LIST ?>
<div class="div_new_add">
  <form id="form-new" class="class_new_add">
    <input style="display: none" type="text" name="title_home" value="<?php echo $title_full; ?>" />
    <input style="display: none" name="favorite_home" value="favorite_home" />
    <input id="btn_mylist_off_home" type="submit" name="btn_password" value="" class="class_fav_hover_off">
  </form>
</div>
<?php } ?>
</div>

<?php } // END LOOP ?>
        
<script>
$(function() {
  $('.class_new_add').on('submit', function(event) {
    event.preventDefault();
    $.ajax({
      type: 'POST',
      url: 'ajax/mylist.php',
      context:$(this),
      data: $(this).serialize(),
      success: function(data) {
        $(this).closest("div").html("<div class="div_new_delete"><form id="form-new" class="class_new_delete"><input style="display: none" type="text" name="title_home" value="<?php echo $title_full; ?>" /><input style="display: none" name="favorite_delete_home" value="favorite_delete_home" /><input id="btn_mylist_off_home" type="submit" name="btn_password" value="" class="class_fav_hover_on"></form></div>")
      }
    });
  });
});
$(function() {
  $('.class_new_delete').on('submit', function(event) {
    event.preventDefault();
    $.ajax({
      type: 'POST',
      url: 'ajax/mylist.php',
      context:$(this),
      data: $(this).serialize(),
      success: function(data) {
        $(this).closest("div").html("<div class="div_new_add"><form id="form-new" class="class_new_add"><input style="display: none" type="text" name="title_home" value="<?php echo $title_full; ?>" /><input style="display: none" name="favorite_home" value="favorite_home" /><input id="btn_mylist_on_home" type="submit" name="btn_password" value="" class="class_fav_hover_off"></form></div>")
      }
    });
  });
});
</script>
</div>

ajax/mylist.php

<?php

include "../includes/db_connector.php"; ?>

<?php if ( isset( $_POST[ 'favorite_home' ] )) { // HOMEPAGE AJAX ATTEMPT       
$stmt_favorites = $db_connect->prepare("INSERT INTO my_list (title, username) VALUES (?, ?)");
$stmt_favorites->bind_param("ss", $title_home, $username);
$title_home = $_POST['title_home'];
$result=$stmt_favorites->execute();
$stmt_favorites->close();  
} ?>

<?php if ( isset( $_POST[ 'favorite_delete_home' ] )) { // HOMEPAGE AJAX ATTEMPT
$stmt_favorites = $db_connect->prepare("DELETE FROM my_list WHERE title = ? AND username = ?");
$stmt_favorites->bind_param("ss", $title_home, $username);
$title_home = $_POST['title_home'];
$result=$stmt_favorites->execute();
$stmt_favorites->close();
} ?>

React show error: Failed to execute ‘removeChild’ on ‘Node’: The node to be removed is not a child of this node

I am creating input as div contentEditable and I am setting condition to render child content inside div but I getting the error when entering text to the div:

NotFoundError: Failed to execute ‘removeChild’ on ‘Node’: The node to
be removed is not a child of this node.

const [text, setText] = useState('');

const handleChange = e => {
   setText(e.target.textContent)
}

<div
     contentEditable={true}
     onInput={handleChange}
     suppressContentEditableWarning
>
   <div>{!text ? <br /> : <p>{text}</p>}</div>
</div>

How can I resolve this error?

Listening to paste event on div

I’m trying to upgrade an app using a vis network that displays a graph (using a canvas). The idea is to add a paste functionality, so that you could paste content from a different graph, or from a string.

I implemented a copy functionality based on navigator.clipboard. I attach an event handler to the document:

const copier = (e: ClipboardEvent) => {
  if (document.getSelection()?.type !== "Range") {
    // ...
    navigator.clipboard.writeText(JSON.stringify(graph));
  }
};

document.addEventListener("copy", copier)

This if is the only way I found to not interfere with “normal” copy events (selecting text outside the graph then CTRL + C for example). Not sure if it’s ideal.

The real problem is with pasting. I can’t just listen to “paste” events on document because I haven’t found a way to identify that the paste is for the graph and not some other component in the app displayed at the same time (a text input for example).

I have tried the following:

  • Attaching the event listener to the div container: doesn’t catch the event
  • Checking the ClipboardEvent‘s target and currentTarget: they don’t match the graph’s div container, and results are inconsistent across browsers.
  • Focusing the div before pasting (with mydiv.focus() and tabIndex=1), the paste is still not caught
  • Using contenteditable on the div, but this messes with a lot of other things

After long searches and a lot of trials, I haven’t found an answer to this.
Thank you for your help.

Trying to caught an uncaught error from Axios used with React Query (suspense mode true) and NextJs

I’m using NextJS, React query (with axios and suspense mode) and I’m trying to catch an error from my API which return 404 en purpose. I succeed to catch it in my error.js file but the same error appear in the console as “uncaught”
enter image description here

I trying to log and catch this error in my composant where I use the react query too but still I can got it and log it but it still “Uncaught” in the console.

Here’s my Home composant
enter image description here

My route
enter image description here

And my error.js
enter image description here

Any idea how to catch this error ?