hashload / handle-exception Goto Github PK
View Code? Open in Web Editor NEWMiddleware for handle exception in HORSE
License: MIT License
Middleware for handle exception in HORSE
License: MIT License
Melhorar a documentação
Quando o projeto é compilado em 32 bits funciona.
Quando compilo para 64 bits apresenta esse erro
"Access violation at address 000000000035EF25 in module 'ServerEcommerce.exe'. Read of address 00000000FFFFFFDF"
exemplo do código:
raise EHorseException.New.Error('Usuário/Senha inválido!').Status(THTTPStatus.Unauthorized);
Update readme and samples
Create Lazarus samples
Há diversos overloads para EHorseException
que recebem o parâmetro AStatus
, porém a propriedade Status
não é utilizada para obter o código de status Http, como trecho de código atual:
on E: EHorseException do
begin
LJSON := TJSONObject.Create;
LJSON.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}('error', E.Error);
if not E.Title.Trim.IsEmpty then
begin
LJSON.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}('title', E.Title);
end;
if not E.&Unit.Trim.IsEmpty then
begin
LJSON.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}('unit', E.&Unit);
end;
if E.Code <> 0 then
begin
LJSON.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}('code', {$IF DEFINED(FPC)}TJSONIntegerNumber{$ELSE}TJSONNumber{$ENDIF}.Create(E.Code));
end;
if E.&Type <> TMessageType.Default then
begin
LJSON.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}('type', GetEnumName(TypeInfo(TMessageType), Integer(E.&Type)));
end;
SendError(Res, LJSON, E.Code);
end;
Sugestão:
Criar método write para propriedade FStatus, escrevendo também na propriedade FCode;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.