File Coverage

lib/Finance/Robinhood/Error.pm
Criterion Covered Total %
statement 9 17 52.9
branch n/a
condition 0 2 0.0
subroutine 3 5 60.0
pod n/a
total 12 24 50.0


line stmt bran cond sub pod time code
1             package Finance::Robinhood::Error;
2              
3             =encoding utf-8
4              
5             =for stopwords watchlist watchlists untradable urls
6              
7             =head1 NAME
8              
9             Finance::Robinhood::Error - What You Find When Things Go Wrong
10              
11             =head1 SYNOPSIS
12              
13             use Finance::Robinhood;
14              
15             my $rh = Finance::Robinhood->new->login( 'timbob35', 'hunter3' ); # Wrong password
16             $rh || die $rh; # false value is retured; stringify it as a fatal error
17              
18             =head1 DESCRIPTION
19              
20             When this distribution has trouble with anything, this is returned.
21              
22             Error objects evaluate to untrue values.
23              
24             Error objects stringify to the contents of C or 'Unknown error.'
25              
26             =head1 METHODS
27              
28             =cut
29              
30             our $VERSION = '0.92_003';
31 1     1   7 use Mojo::Base-base, -signatures;
  1         2  
  1         6  
32 1     1   211 use Mojo::URL;
  1         1  
  1         5  
33 0     0     use overload 'bool' => sub ($s, @) {0},
  0            
  0            
  0            
34 0     0     '""' => sub ($s, @) {
  0            
  0            
35 0   0       $s->detail // 'Unknown error.';
36             },
37 1     1   97 fallback => 1;
  1         3  
  1         11  
38             #
39              
40             =head2 C
41              
42             warn $error->detail;
43              
44             Returns a string. If this is a failed API call, the message returned by the
45             service is here.
46              
47             =cut
48              
49             has _rh => undef => weak => 1;
50             has ['detail'];
51              
52             =head1 LEGAL
53              
54             This is a simple wrapper around the API used in the official apps. The author
55             provides no investment, legal, or tax advice and is not responsible for any
56             damages incurred while using this software. This software is not affiliated
57             with Robinhood Financial LLC in any way.
58              
59             For Robinhood's terms and disclosures, please see their website at
60             https://robinhood.com/legal/
61              
62             =head1 LICENSE
63              
64             Copyright (C) Sanko Robinson.
65              
66             This library is free software; you can redistribute it and/or modify it under
67             the terms found in the Artistic License 2. Other copyrights, terms, and
68             conditions may apply to data transmitted through this module. Please refer to
69             the L section.
70              
71             =head1 AUTHOR
72              
73             Sanko Robinson Esanko@cpan.orgE
74              
75             =cut
76              
77             1;