Skip to content

Commit

Permalink
catch exception !
Browse files Browse the repository at this point in the history
  • Loading branch information
angelcolmenares committed Jun 24, 2012
1 parent d0c8005 commit e92641c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/Aicl.Colmetrik.BusinessLogic/BL.Pedido.cs
Expand Up @@ -12,6 +12,7 @@
using ServiceStack.CacheAccess;
using ServiceStack.ServiceHost;
using ServiceStack.DesignPatterns.Model;
using ServiceStack.ServiceInterface.ServiceModel;
using Aicl.Colmetrik.Model.Types;
using Aicl.Colmetrik.Model.Operations;
using Aicl.Colmetrik.DataAccess;
Expand All @@ -28,7 +29,7 @@ public static partial class BL
long? totalCount=null;

var predicate = PredicateBuilder.Null<Pedido>();

try{
var data = factory.Execute(proxy=>{
var visitor = ReadExtensions.CreateExpression<Pedido>();
if(!request.NombreCompania.IsNullOrEmpty())
Expand All @@ -53,8 +54,18 @@ public static partial class BL
return new Response<Pedido>(){
Data=data,
TotalCount=totalCount

};
}
catch(Exception e){
ResponseStatus rs = new ResponseStatus(){
Message= e.Message,
StackTrace=e.StackTrace,
ErrorCode= "GetPedidoError"
};
return new Response<Pedido>(){
ResponseStatus=rs
};
}
}
}

Expand Down
14 changes: 13 additions & 1 deletion src/Aicl.Colmetrik.BusinessLogic/BL.PedidoItem.cs
Expand Up @@ -15,6 +15,7 @@
using Aicl.Colmetrik.Model.Types;
using Aicl.Colmetrik.Model.Operations;
using Aicl.Colmetrik.DataAccess;
using ServiceStack.ServiceInterface.ServiceModel;

namespace Aicl.Colmetrik.BusinessLogic
{
Expand All @@ -23,7 +24,7 @@ public static partial class BL
public static Response<PedidoItem> Get(this PedidoItem request,Factory factory,
IAuthSession authSession)
{

try{
var data = factory.Execute(proxy=>{
var visitor = ReadExtensions.CreateExpression<PedidoItem>();
visitor.Where(r=>r.IdPedido==request.IdPedido);
Expand All @@ -34,6 +35,17 @@ public static partial class BL
Data=data

};
}
catch(Exception e){
ResponseStatus rs = new ResponseStatus(){
Message= e.Message,
StackTrace=e.StackTrace,
ErrorCode= "GetPedidoItemError"
};
return new Response<PedidoItem>(){
ResponseStatus=rs
};
}
}

}
Expand Down

0 comments on commit e92641c

Please sign in to comment.