Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How can I propagate an exception from Spring to Flex (Cairngorm)?

Avatar

Level 1
Hello:



I would like to throw an exception (Spring) and propagate it
to the fault function at the Command class (Cairngorm).



Here is the code. The exception in thrown but the code in the
fault function is never executed.



public class BankServiceImpl extends HibernateDaoSupport
implements IBankService {



...



public void deleteBank(Bank bank){

IBankService bankService = new
BankServiceImpl(this.getHibernateTemplate(),
this.getSessionFactory());

Collection<Bank> list = bankService.getBanks();

if(lista.isEmpty()){

throw new Exception("MyMessage");

...

}

}



The code in the command is:



public class DeleteBankCommand implements ICommand,
IResponder

{

...

public function fault( ev : Object ) : void

{

var faultEvent : FaultEvent = FaultEvent( ev );

Alert.show( faultEvent.message.toString() );

}//fin funcion fault

}



Thank you all
2 Replies

Avatar

Former Community Member
Can you check that the faultEvent.fault.rootCause is not null
and may contain

your exception object?







Hello Kgnytia,



> Hello:

>

> I would like to throw an exception (Spring) and
propagate it to the

> fault function at the Command class (Cairngorm).

>

> Here is the code. The exception in thrown but the code
in the fault

> function is never executed.

>

> public class BankServiceImpl extends HibernateDaoSupport
implements

> IBankService {

>

> ...

>

> public void deleteBank(Bank bank){

> IBankService bankService = new

> BankServiceImpl(this.getHibernateTemplate(),

> this.getSessionFactory());

> Collection<Bank> list = bankService.getBanks();

> if(lista.isEmpty()){

> throw new Exception("MyMessage");

> ...

> }

> }

> The code in the command is:

>

> public class DeleteBankCommand implements ICommand,
IResponder

> {

> ...

> public function fault( ev : Object ) : void

> {

> var faultEvent : FaultEvent = FaultEvent( ev );

> Alert.show( faultEvent.message.toString() );

> }//fin funcion fault

> }

> Thank you all

>





Avatar

Level 1
Thank you for your reply.



Actually, the problem is that when the exception is thrown,
the fault function at the Command class doesnt notice. It never
enters into the fault function.