Рівно рік тому вийшла книга:
Al Engineering: Building Applications with Foundation Models
За цей час вона не втратила актуальності. Раджу прочитати, щоб триматися на ринку.
Post #899
3.13K

- 👍 35
- ❤ 9
- 🥱 2
NO @node_recipes
Showing posts older than #900 · Back to latest


Forwarded from DOU

process.env.TZ = 'UTC'

На співбесідах я завжди кажу щось на зразок:
I’m an expert in TypeScript, Node.js, AWS, but I’m not married to this tech stack and open to new approaches and tools.



"Я уникаю Next.js через поганий DevExp" - розшифруйте будь ласка.
cancelled, а в інших — canceled. Зрештою з’ясувалося, що розбіжність походить ще з документації, де описувався план для coding-агентів. Тепер він проводить рефакторинг, щоб впровадити StrEnum для уніфікації.// без String.raw
const file = `C:\\windows\\temp\\myapp-${process.pid}.log`;
const re = `\\d{4}-\\d{2}-\\d{2}`;
// із String.raw
const file = String.raw`C:\windows\temp\myapp-${process.pid}.log`;
const re = String.raw`\d{4}-\d{2}-\d{2}`;
@Transaction, фільтр є єдиним місцем, де можна перехопити помилку на рівні запиту.import type { ArgumentsHost, ExceptionFilter } from '@nestjs/common';
import { Catch } from '@nestjs/common';
import { Response } from 'express';
import { DatabaseError } from 'pg';
import { QueryFailedError } from 'typeorm';
@Catch(QueryFailedError)
export class TypeormExceptionFilter implements ExceptionFilter {
catch(exception: QueryFailedError, host: ArgumentsHost) {
const context = host.switchToHttp();
const response = context.getResponse<Response>();
if (exception.driverError instanceof DatabaseError) {
if (exception.driverError.code === '40001') {
return response.status(409).send({
message: 'Conflict. Please try again later.',
});
}
if (exception.driverError.code === '23505') {
return response.status(400).send({
message: 'Should be unique',
});
}
if (exception.driverError.code === '23514') {
switch (exception.driverError.constraint) {
case 'not_negative_balance_check': {
return response.status(400).send({
message: 'Not enough balance',
});
}
//…
}
}
}
throw exception;
}
}