1/*
2* Copyright 2006 Sony Computer Entertainment Inc.
3*
4* Licensed under the MIT Open Source License, for details please see license.txt or the website
5* http://www.opensource.org/licenses/mit-license.php
6*
7*/
8
9#include <dae/daeError.h>
10
11typedef struct
12{
13	int errCode;
14	const char *errString;
15} DAEERROR;
16
17static DAEERROR errorsArray[] =
18{
19	{ DAE_OK, "Success" },
20	{ DAE_ERROR, "Generic error" },
21	{ DAE_ERR_INVALID_CALL, "Invalid function call" },
22	{ DAE_ERR_FATAL, "Fatal" },
23	{ DAE_ERR_BACKEND_IO, "Backend IO" },
24	{ DAE_ERR_BACKEND_VALIDATION, "Backend validation" },
25	{ DAE_ERR_QUERY_SYNTAX, "Query syntax" },
26	{ DAE_ERR_QUERY_NO_MATCH, "Query no match" },
27	{ DAE_ERR_COLLECTION_ALREADY_EXISTS, "A document with the same name exists already" },
28	{ DAE_ERR_COLLECTION_DOES_NOT_EXIST, "No document is loaded with that name or index" },
29	{ DAE_ERR_NOT_IMPLEMENTED, "This function is not implemented in this reference implementation" },
30};
31
32const char *daeErrorString(int errorCode)
33{
34	int iErrorCount = (int)(sizeof(errorsArray)/sizeof(DAEERROR));
35	for (int i=0;i<iErrorCount;i++)
36	{
37		if (errorsArray[i].errCode == errorCode)
38			return errorsArray[i].errString;
39	}
40	return "Unknown Error code";
41}
42