// Error messages with time-of-day awareness // Each error code has multiple witty messages that rotate randomly function getErrorMessage(errorCode) { const today = new Date(); // Your timezone, your problem - we just read what your browser tells us const hours = today.getHours(); const timeContext = hours < 6 ? 'late' : hours < 12 ? 'morning' : hours < 18 ? 'afternoon' : 'evening'; const messages = { 400: [ "Bad Request? More like bad judgment. What were you even thinking?", "Your browser sent something that made the server question its life choices.", "Syntax error: human detected. Please reformat your existence.", "The server tried to parse your request. It failed. Miserably.", "This isn't a buffet. You can't just order whatever you want.", "Your request was so malformed, it gave the parser an existential crisis.", "Bad request? That's putting it mildly. The server is offended.", "The server politely declined your request. It's not you, it's... actually, it is you." ], 401: [ "Unauthorized. You shall not pass. Unless you have the password.", "Access denied. This area requires more credentials than a spy movie.", "You need authentication. This isn't a BYOB party.", "Unauthorized access attempt. The server is judging you right now.", "Credentials required. No, 'password123' doesn't count.", "Authentication failed. Try harder. Or don't. The server doesn't care.", "Access denied. Even the server has standards.", "You're not authorized. The bouncer said no." ], 403: [ "Forbidden. This isn't the page you're looking for. Move along.", "Access forbidden. The server has trust issues. Can you blame it?", "Permission denied. The server said 'absolutely not' in seventeen languages.", "Forbidden territory. Even VPNs can't save you now.", "This area is off-limits. The server drew a line. You crossed it.", "Access forbidden. The server is protecting you from yourself.", "Permission denied. The server would rather die than show you this.", "Forbidden. This page has restraining orders against browsers like yours.", "Access denied. The server is gatekeeping. Deal with it.", "This content is forbidden. The server has standards, unlike some people." ], 404: [ "Page not found. It's gone. Vanished. Poof. Like my motivation on Monday.", "The page you seek does not exist in this dimension. Try another reality.", "This page doesn't exist. Neither do my regrets about creating this message.", "The server searched everywhere. Even checked under the couch.", "Page not found. It left. Said it needed to find itself. We're all very supportive.", "The page you're looking for has achieved enlightenment and transcended the web.", "This page doesn't exist. It's not you, it's me. Actually, it's definitely you.", "The server even checked the last place you'd look. Still nothing.", "Page not found. It's in witness protection. The server knows where it is but won't tell.", "The page escaped. Last seen heading toward the exit. We're not chasing it.", "This page doesn't exist. The server looked twice. Still gone. Accept it.", "The page ran away to join the circus. Good for it." ], 405: [ "Method not allowed. The server rejected your approach. Try a different strategy.", "HTTP method denied. The server is picky about how you ask questions.", "Method not allowed. The server prefers a more elegant approach.", "This method isn't allowed here. The server has strict rules about manners.", "Method rejected. The server wants you to ask nicely next time.", "HTTP method not allowed. The server is traditional. Write a letter instead." ], 408: [ "Request timeout. You took too long. The server has moved on with its life.", "Timeout. The server waited. And waited. And got tired of waiting.", "Request timeout. The server gave up. You should probably do the same.", "Too slow. The server timed out waiting for you to make up your mind.", "Request timeout. The server has better things to do than wait for your request.", "Timeout. The server lost interest. Can you blame it?" ], 429: [ "Slow down, turbo. The server isn't impressed by your enthusiasm.", "Rate limit exceeded. You've been greedy. The server noticed.", "The server is overwhelmed. By you. Specifically.", "Rate limit. You're making too many requests. The server needs a break from you.", "The server is putting you in timeout. Think about what you've done.", "Rate limit exceeded. The server is judging your lack of patience.", "Slow down. You're making too many requests. The server has trust issues now.", "Rate limit exceeded. The server says 'no more'. It's not negotiable." ], 500: [ "We may or may not have broken something. Oops.", "Something went wrong. We're pretending it's not our fault.", "The server had a moment. It happens. Usually on Fridays.", "The hamsters powering the server need a coffee break.", "Something broke. The server is working on it. Or sleeping. Hard to tell.", "The server made a mistake. We're all human. Well, the server isn't, but you know.", "The server tried its best. Its best wasn't good enough today.", "Something crashed. Probably our hopes and dreams.", "The server is having an existential crisis. Give it a moment.", "The server regrets to inform you that it regrets.", "Something went wrong. The server is embarrassed. Please look away.", "The server encountered an error while encountering an error. Meta." ], 502: [ "The upstream server is having a bad day. Join the club.", "The server talked to another server. They're not speaking anymore.", "The server reached out for help. The other server hung up.", "The gateway is bad. The server would elaborate, but it's bad at explaining things.", "The upstream server said 'no'. We're respecting its boundaries.", "Two servers walked into a bar. Neither ordered anything useful.", "The server called for backup. Backup didn't answer.", "Communication failed between servers. Relationship status: it's complicated." ], 503: [ "The server is currently unavailable. Try again later. Or don't. Your choice.", "The server is taking a mental health day.", "The server is out of the office. It left a note. We can't read it.", "The service is down. The server is using this time to reflect on its choices.", "The server is temporarily unavailable. Permanently temporary.", "The service is taking a break. Self-care is important, even for servers.", "The server is busy. It's busy being unavailable.", "The service is down for maintenance. Or questioning its purpose. Same thing." ], 504: [ "The server waited too long. It's done waiting.", "The gateway timed out waiting for another server. Patience isn't infinite.", "The server waited patiently. Then impatiently. Then gave up.", "The gateway is having commitment issues. It won't wait forever.", "The other server took too long. This server has places to be.", "The gateway waited. And waited. Now it's leaving.", "The server's patience expired before your request did.", "Time's up. The gateway moved on. You should too." ] }; const errorMessages = messages[errorCode] || [ `Error ${errorCode}. Something went wrong. The server is confused, and honestly, so are we.` ]; // Randomly select a message const randomIndex = Math.floor(Math.random() * errorMessages.length); return errorMessages[randomIndex]; }