Skip to content

Bug: Migration Exceptions are hidden and cause Deadlocks #17

@HarryCordewener

Description

@HarryCordewener

I have a Migration written. When an error is thrown (Because the Database does not exist, or a Schema item fails to match), it should be throwing an Exception. Instead, the error seems to be swallowed up and it deadlocks.

Collection = new ArangoCollection
{
		Name = "node_objects",
		Type = ArangoCollectionType.Document,
		KeyOptions = new ArangoKeyOptions()
		{
				AllowUserKeys = true,
				Type = ArangoKeyType.Traditional
		},
		Schema = new ArangoSchema()
		{
				Rule = new {
						properties = new {
								DBRef = new { type = "number", multipleOf = 1 },
								Name = new { type = "string" },
								Locks = new { type = "object" },
								CreationTime = new { type = "number" },
								Powers = new { type = "array", items = "string" }
						},
						required = (string[])[nameof(SharpObject.DBRef), nameof(SharpObject.Name)]
				}
		}
var roomZeroObj = await migrator.Context.Document.CreateAsync(handle, "node_objects", new SharpObject
{
		Name = "Room Zero",
		DBRef = 0,
		CreationTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
});
Core.Arango.ArangoException
  HResult=0x80131500
  Message=[{"error":true,"errorNum":1620,"errorMessage":"schema validation failed"}]
  Source=Core.Arango
  StackTrace:
   at Core.Arango.Transport.ArangoHttpTransport.<SendAsync>d__6`1.MoveNext()
   at Core.Arango.Modules.Internal.ArangoDocumentModule.<CreateManyAsync>d__3`2.MoveNext()
   at Core.Arango.Modules.Internal.ArangoDocumentModule.<CreateAsync>d__6`1.MoveNext()
   at SharpMUSH.Database.Migrations.Migration_CreateDatabase.<Up>d__4.MoveNext() in D:\CSharpPennMUSH\SharpMUSH.Database\Migrations\Migration_CreateDatabase.cs:line 303

  This exception was originally thrown at this call stack:
    [External Code]
    SharpMUSH.Database.Migrations.Migration_CreateDatabase.Up(Core.Arango.Migration.IArangoMigrator, Core.Arango.ArangoHandle) in Migration_CreateDatabase.cs

I can see the exceptions if I turn on all CLR Exceptions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions