I need one example for Terminology

Oct 4, 2014 at 8:56am
Hi,

.... Fault -->(Activation) Error --->(Propagation) Failure is chain .

For better understand it, I need one simple piece of code which show the above chain.
I need to more explain for Failure (And means about propagation).

When may be lead to failure and not lead to failure.

Thank you
Oct 5, 2014 at 7:12am
........
Oct 5, 2014 at 7:42am
closed account (48T7M4Gy)
If it was me I'd also be asking Professor Google nicely for her thoughts on the subject(s).
Oct 5, 2014 at 8:22am
Yes,But i need pseudo code for this chain.
Oct 5, 2014 at 9:09am
A tiny chain, three functions long:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
std::map< std::string, std::string > retrieve( LDAP* ldap, const std::string& query ) 
{
    if( ldap_simple_bind_s( ldap, nullptr, nullptr ) != LDAP_SUCCESS )
        throw std::runtime_error( "ldap bind failed" ) ; // discover error (fault); activation (throw)
    
    // populate map, return result
}


void print_attributes( const std::string& user_id )
{
    LDAP* ldap = dap_init( /* ... */ ) ; 
    // if( LDAP == nullptr ) throw ...
    
    const auto map = retrieve( "uid=" + user_id + ", ou=members, dc=join_date, dc=post_count" ) ;
    // if exception is thrown,transparently propagate to caller (propagation)
    
    // print contents of map
    
    // ...
}

int main()
{
    std::string member = "Life24" ;

    try
    {
        print_attributes(member) ;
        // ...
    }
    
    catch( const std::exception& e ) // propagated to catch block
    {
        // recognise and handle error (handle failure)
    }
}


Call chain: main() => print_attributes() => retrieve()

Fault propagation chain: retrieve() (fault,activate) => print_attributes() (propagate) => main() (handle failure)
Topic archived. No new replies allowed.