Diff
Not logged in

Differences From Artifact [a5c8048813]:

To Artifact [ac0ac00c7c]:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
...
188
189
190
191
192
193
194






195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
...
261
262
263
264
265
266
267
268



269
270
271
272
273
274
275
276
277
278
279



280
281
282
283
284
285
286
...
413
414
415
416
417
418
419

420
421
422
423
424
425
426
427
428
429
430
431
432
// Copyright 2015 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under (1) the MaidSafe.net Commercial License,
// version 1.0 or later, or (2) The General Public License (GPL), version 3, depending on which
// licence you accepted on initial access to the Software (the "Licences").
//
// By contributing code to the SAFE Network Software, or to this project generally, you agree to be
// bound by the terms of the MaidSafe Contributor Agreement, version 1.0.  This, along with the
// Licenses can be found in the root directory of this project at LICENSE, COPYING and CONTRIBUTOR.
//
// Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.
//
// Please review the Licences for the specific language governing permissions and limitations
// relating to use of the SAFE Network Software.


use core::SelfEncryptionStorageError;
use maidsafe_utilities::serialisation::SerialisationError;
use routing::DataIdentifier;
use routing::client_errors::{GetError, MutationError};
use routing::messaging;
use self_encryption::SelfEncryptionError;
................................................................................
            }
            CoreError::MutationFailure { reason: MutationError::NetworkFull, .. } => {
                CLIENT_ERROR_START_RANGE - 27
            }
            CoreError::MutationFailure { reason: MutationError::DataTooLarge, .. } => {
                CLIENT_ERROR_START_RANGE - 28
            }






            CoreError::SelfEncryption(
                SelfEncryptionError::Compression::<SelfEncryptionStorageError>) => {
                CLIENT_ERROR_START_RANGE - 29
            }
            CoreError::SelfEncryption(
                SelfEncryptionError::Decryption::<SelfEncryptionStorageError>) => {
                CLIENT_ERROR_START_RANGE - 30
            }
            CoreError::SelfEncryption(SelfEncryptionError::Io::<SelfEncryptionStorageError>(_)) => {
                CLIENT_ERROR_START_RANGE - 31
            }
            CoreError::GetAccountInfoFailure { reason: GetError::NoSuchAccount, .. } => {
                CLIENT_ERROR_START_RANGE - 32
            }
            CoreError::GetAccountInfoFailure { .. } => CLIENT_ERROR_START_RANGE - 33,
            CoreError::RequestTimeout => CLIENT_ERROR_START_RANGE - 34,
            CoreError::SelfEncryption(SelfEncryptionError
                                      ::Storage
                                      ::<SelfEncryptionStorageError>(
                                          SelfEncryptionStorageError(err))) => (*err).into(),
            CoreError::InvalidStructuredDataTypeTag => CLIENT_ERROR_START_RANGE - 35,
        }
    }
}

impl Debug for CoreError {
    fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
        try!(write!(formatter, "{} - ", self.description()));
        match *self {
            CoreError::StructuredDataHeaderSizeProhibitive => {
                write!(formatter, "CoreError::StructuredDataHeaderSizeProhibitive")
            }
            CoreError::UnsuccessfulEncodeDecode(ref error) => {
                write!(formatter,
                       "CoreError::UnsuccessfulEncodeDecode -> {:?}",
................................................................................
                write!(formatter, "CoreError::UnsupportedSaltSizeForPwHash")
            }
            CoreError::UnsuccessfulPwHash => write!(formatter, "CoreError::UnsuccessfulPwHash"),
            CoreError::OperationAborted => write!(formatter, "CoreError::OperationAborted"),
            CoreError::MpidMessagingError(ref error) => {
                write!(formatter, "CoreError::MpidMessagingError -> {:?}", error)
            }
            CoreError::GetFailure { ref data_id, ref reason } => {



                write!(formatter,
                       "CoreError::GetFailure::{{ reason: {:?}, data_id: {:?}}}",
                       reason,
                       data_id)
            }
            CoreError::GetAccountInfoFailure { ref reason } => {
                write!(formatter,
                       "CoreError::GetAccountInfoFailure::{{ reason: {:?}}}",
                       reason)
            }
            CoreError::MutationFailure { ref data_id, ref reason } => {



                write!(formatter,
                       "CoreError::MutationFailure::{{ reason: {:?}, data_id: {:?}}}",
                       reason,
                       data_id)
            }
            CoreError::SelfEncryption(ref error) => {
                write!(formatter, "CoreError::SelfEncryption -> {:?}", error)
................................................................................
        }
    }
}

#[cfg(test)]
mod test {


    use core::SelfEncryptionStorageError;
    use rand;
    use routing::DataIdentifier;
    use routing::client_errors::MutationError;
    use self_encryption::SelfEncryptionError;
    use super::*;

    #[test]
    fn self_encryption_error() {
        let id = rand::random();
        let core_err_0 = CoreError::MutationFailure {
            data_id: DataIdentifier::Structured(id, 10000),
            reason: MutationError::LowBalance,







|
|







<







 







>
>
>
>
>
>


|



|


|


|

|
|




|






|







 







|
>
>
>










|
>
>
>







 







>





<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
...
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
...
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
...
424
425
426
427
428
429
430
431
432
433
434
435
436

437
438
439
440
441
442
443
// Copyright 2015 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under (1) the MaidSafe.net Commercial License,
// version 1.0 or later, or (2) The General Public License (GPL), version 3, depending on which
// licence you accepted on initial access to the Software (the "Licences").
//
// By contributing code to the SAFE Network Software, or to this project generally, you agree to be
// bound by the terms of the MaidSafe Contributor Agreement.  This, along with the Licenses can be
// found in the root directory of this project at LICENSE, COPYING and CONTRIBUTOR.
//
// Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.
//
// Please review the Licences for the specific language governing permissions and limitations
// relating to use of the SAFE Network Software.


use core::SelfEncryptionStorageError;
use maidsafe_utilities::serialisation::SerialisationError;
use routing::DataIdentifier;
use routing::client_errors::{GetError, MutationError};
use routing::messaging;
use self_encryption::SelfEncryptionError;
................................................................................
            }
            CoreError::MutationFailure { reason: MutationError::NetworkFull, .. } => {
                CLIENT_ERROR_START_RANGE - 27
            }
            CoreError::MutationFailure { reason: MutationError::DataTooLarge, .. } => {
                CLIENT_ERROR_START_RANGE - 28
            }
            CoreError::MutationFailure { reason: MutationError::InvalidInvitation, .. } => {
                CLIENT_ERROR_START_RANGE - 29
            }
            CoreError::MutationFailure {
                reason: MutationError::InvitationAlreadyClaimed, ..
            } => CLIENT_ERROR_START_RANGE - 30,
            CoreError::SelfEncryption(
                SelfEncryptionError::Compression::<SelfEncryptionStorageError>) => {
                CLIENT_ERROR_START_RANGE - 31
            }
            CoreError::SelfEncryption(
                SelfEncryptionError::Decryption::<SelfEncryptionStorageError>) => {
                CLIENT_ERROR_START_RANGE - 32
            }
            CoreError::SelfEncryption(SelfEncryptionError::Io::<SelfEncryptionStorageError>(_)) => {
                CLIENT_ERROR_START_RANGE - 33
            }
            CoreError::GetAccountInfoFailure { reason: GetError::NoSuchAccount, .. } => {
                CLIENT_ERROR_START_RANGE - 34
            }
            CoreError::GetAccountInfoFailure { .. } => CLIENT_ERROR_START_RANGE - 35,
            CoreError::RequestTimeout => CLIENT_ERROR_START_RANGE - 36,
            CoreError::SelfEncryption(SelfEncryptionError
                                      ::Storage
                                      ::<SelfEncryptionStorageError>(
                                          SelfEncryptionStorageError(err))) => (*err).into(),
            CoreError::InvalidStructuredDataTypeTag => CLIENT_ERROR_START_RANGE - 37,
        }
    }
}

impl Debug for CoreError {
    fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
        write!(formatter, "{} - ", self.description())?;
        match *self {
            CoreError::StructuredDataHeaderSizeProhibitive => {
                write!(formatter, "CoreError::StructuredDataHeaderSizeProhibitive")
            }
            CoreError::UnsuccessfulEncodeDecode(ref error) => {
                write!(formatter,
                       "CoreError::UnsuccessfulEncodeDecode -> {:?}",
................................................................................
                write!(formatter, "CoreError::UnsupportedSaltSizeForPwHash")
            }
            CoreError::UnsuccessfulPwHash => write!(formatter, "CoreError::UnsuccessfulPwHash"),
            CoreError::OperationAborted => write!(formatter, "CoreError::OperationAborted"),
            CoreError::MpidMessagingError(ref error) => {
                write!(formatter, "CoreError::MpidMessagingError -> {:?}", error)
            }
            CoreError::GetFailure {
                ref data_id,
                ref reason,
            } => {
                write!(formatter,
                       "CoreError::GetFailure::{{ reason: {:?}, data_id: {:?}}}",
                       reason,
                       data_id)
            }
            CoreError::GetAccountInfoFailure { ref reason } => {
                write!(formatter,
                       "CoreError::GetAccountInfoFailure::{{ reason: {:?}}}",
                       reason)
            }
            CoreError::MutationFailure {
                ref data_id,
                ref reason,
            } => {
                write!(formatter,
                       "CoreError::MutationFailure::{{ reason: {:?}, data_id: {:?}}}",
                       reason,
                       data_id)
            }
            CoreError::SelfEncryption(ref error) => {
                write!(formatter, "CoreError::SelfEncryption -> {:?}", error)
................................................................................
        }
    }
}

#[cfg(test)]
mod test {

    use super::*;
    use core::SelfEncryptionStorageError;
    use rand;
    use routing::DataIdentifier;
    use routing::client_errors::MutationError;
    use self_encryption::SelfEncryptionError;


    #[test]
    fn self_encryption_error() {
        let id = rand::random();
        let core_err_0 = CoreError::MutationFailure {
            data_id: DataIdentifier::Structured(id, 10000),
            reason: MutationError::LowBalance,